1

As we know, the index table (which maps bytes in [0, 63] to characters) of Base64 encoding is public, so everyone can decode Base64 strings from others.

But what if we use a shuffled index table and keep it secret? Can we see Base64 with this new table as some sort of safe encryption, and the shuffled table as cipher?

1 Answers1

5

Can we see Base64 with this new table as some sort of [..] encryption [...]?

Yes, technically it does constitute a form of encryption as knowledge of a secret key is required to recover plaintext from ciphertext.

Can we see Base64 with this new table as some sort of safe encryption [...]?

NO! This is essentially a monoalphabetic substitution cipher applied on the Base64 encoded data. This can be seen as you can always take your table $T$ and then find a new $T'$ that undoes the base64 table encoding first and then applied after standard Base64 encoding.

Now while the key size is (theoretically) respectable with $\log_2 (64!)\approx 296$ bit, this cipher suffers from all the usual problems such ciphers have, including:

  • Ciphertext-only attacks are possible using frequency analysis, as there are only 64 valid plaintext values and they will probably occur with different frequencies.
  • Known- and chosen plaintext attacks are devastating as there are only 64 mappings to be uncovered and usually plaintexts have quite a bit of structure allowing to guess the rest / uncover significant parts of the plaintext.
SEJPM
  • 46,697
  • 9
  • 103
  • 214