0

I'm reading this article on "How Base64 Encoding Works", and I see that Base64 converts each set of 3 8-bit bytes into binary, then convert that binary into 4 groups of 6 bits. Finally, those 4 groups are reassembled back into integers and converted to ASCII characters.

The example given takes the numbers 155, 162 and 233. When converted into binary, the string becomes "10011011 10100010 11101001". Split into 4 equally-sized groups, this is "100110", "111010", "001011", and "101001". Next, the protocol converts these back into ints (38, 58, 11 and 41).

The last step is the one I don't understand. Quoting the article:

These numbers are converted to ASCII characters in the second step using the Base64 encoding table. The 6-bit values of our example translate to the ASCII sequence "m6Lp".

When I look at the ASCII Table, I don't see how this is true. Using the decimal column on the left of each column and the character column on the right of each column, I would have translated [38, 58, 11 41] to ["&", ":", "VT" (vertical tab), ")"]. Even if I use another column besides the left-hand decimal column (i.e. the Hex column), I still don't get the expected result.

I see the table at the bottom of the screen where "m" clearly correlates with 38. But this table is materially different from what the official ASCII table states.

I assume the problem is my lack of familiarity with ASCII conversion rather than an inaccuracy in the article, so what am I doing incorrectly?

UPDATE: they are two different tables. My mistake when asking this question was assuming that a conversion to ASCII implies using the ASCII conversion table, when in fact there's a different table (the Base64 conversion table, which is what the article depicts).

Richie Thomas
  • 3,073
  • 4
  • 32
  • 55
  • 1
    They're not using the ASCII table, but the _Base64 encoding table_ at the bottom of the article. – jmoerdyk Feb 27 '18 at 16:18
  • @jmoerdyk thanks for that, I saw that table and was confused because it differs from the official ASCII conversion table. I assumed "Base64 Encoding Table" was the article's way of referencing the official ASCII table, when in fact they are two different tables. Your comment cleared that up for me. – Richie Thomas Feb 27 '18 at 16:27

1 Answers1

1

You are doing nothing incorrectly. Table used in article to translate binary code to chars is different to your table.

You can recheck it with this nice tool: https://www.rapidtables.com/code/text/ascii-table.html

Kajbo
  • 1,068
  • 3
  • 16
  • 31