Encoder Format version: v1 2 way data encoding Final filetype: PNG Source data + Key order + Internal options + IR Size => IR to_8bit(IR) + color profile => PNG Source data ex: 'Hello World' Any bits we want to encode into the PNG. Only been using text at the moment. But any bits would do. Key order ex: 'Helo Wrd' The order in which we assign color to each datum. This is also the alphabet of what is allowed to be encoded and the password to decode the PNG. For now we save this as metadata in the PNG in key "k". This could be a "private key" to restrict who can decode the PNG. Internal options Static internal data we need to encode/decode. This is unique to the encoder. Internal keys are added to the key order before assigning IR values to each key order datum. This also means we need to increment the encoder version if adding/deleting internal options. For this encoder we have the following options: Padding: Add x% of data size as extra space to "File Section". For example a padding of 100 would double the "File Section", 100% additional space. This is a vanity option. Orientation: Determines which location the data is encoded in the "File Section". Three possible values: left, center, right. Left would encode the data at the beginning of the file section, center would do it in the middle, and right at the end. This option plays nicely with padding as padding adds additional space in the file section. This is a also vanity option, make it look different. A lever to pull. Internal Representation (IR) N-bit unique integers that translate 1-to-1 to each datum in the key order. The IR is then translated into 8-bit integers This translation is quite simple; imagine smashing all the bits together of the entire IR then slicing 8-bits at a time. Due to ambiguity in translating 8-bit back to a smaller bit size, the "ir length" is saved in metadata in the PNG in key "i". Color Profile A set of two functions that define how 8-bit integers are translated into colors and vice versa. Colors being 3 8-bit integers (alpha is always set to 1). For example, the gray color profile definition: def to_png(ir_tokens) ir_tokens.map do |ir_token| [ir_token, ir_token, ir_token] end end def from_png(png_triples) png_triples.map do |triple| triple[0] end end Encoded Format: A high level description of what is encoded in the PNG and in what order. Static sections are one pixel while "key ordered encoded" sections are IR bit length. 1234445555 5555555555 5555555555 7788999999 9999999999 9999999666 1 = Static Encoder version This is how we know which encoder to use. 2 = Static IR Bit Size This is how we know the size of each IR datum, a requirement for pulling each IR out of the PNG. 3 = Static Color Profile This is how we know how to get from PNG -> IR. 4 = Static Blank Empty space for extending the encoder (3 pixels right now) 5 = Key order Section A map from IR datum to color. This map is used in all sections afterward. We will note sections with "key ordered encoded" or KOE. 7 = Orientation Options Section (KOE) Key order encoded orientation for this instance. 8 = Padding Options Section (KOE) Key order encoded padding for this instance. 9 = File Section, the data encoded in color (KOE) Key ordered encoded data and extra space. 6 = Signature (KOE) Key ordered encoded signature. Composed of super secret internal tokens. ---------- Dark Lord of Programming