Encoding

Binary-to-text encoding:

  • is encoding of data in plain text, or in other words it is an encoding of binary data in a sequence of printable characters.

  • the encoding is necessary for transmission of data when the channel does not allow binary data (e. g. email).

  • encoding inflates the original data size, the inflate rate depends on the used technique encoding is a reversible operation.

  • it can also be applied to plain text.

Not to be confused with encrypting, it’s not encryption:

  • encryption requires a key, usually secret.

  • encoding doesn’t depend on a key.

Common Encoding Techniques

  • hexadecimal (also known as base16)

    • used chars: [0..9] and [A..F] (or [a..f]).

    • hash values (MD5, SHA245, etc) are usually displayed in hexadecimal.

    • example: “Hello World” → 48656c6c6f20776f726c64

  • base64

    • used chars: [A..Z, [a..z], [0..9], and [+,/]

    • base64 string size must be a multiple of 4, so char = can be used at the end as padding.

    • used on: email servers (MIME), OpenPGP, etc.

    • example: “Hello World” → SGVsbG8gV29ybGQ=.

  • base58

    • similar to base64, but modified to avoid both non-alphanumeric characters and letters which might look ambiguous when printed.

    • used on bitcoins.

    • example: bitcoin public key 1ZNz2KDm8epACBA5bjgKQbRyaGcDt3XV2

    • bitcoin private key: Ky1ZcCSMziFtdxfDEjANw3PZUZQQLjh6hKpX1CinVtJscnAFnvcn

Last updated