# How to decrypt a substitution cipher using a Base64 alphabet [duplicate]

Let us consider a cipher that works like the following:

• Plaintext is encoded to Base64.
• The characters in the encoded plaintext are substituted with a randomly shuffled character set (a-z, 0-9, A-Z, /, +).

The shuffled alphabet are the key. How do I decipher it to get the base64 encoded string without knowing the shuffled character set?

## marked as duplicate by e-sushiMar 9 '17 at 14:47

• i guess you could break it into 6-bit groups and perform a frequency analysis, even better if you can see a known large plaintext, then you can crack it completely – Richie Frame Jan 20 '17 at 0:29
• Related Q/A here. Note that due to the shift you can be reasonably certain that the highest bit is set to zero for ASCII characters. Fun thing is that this will affect multiple positions in the encoding, which should make it easier to perform frequency analysis. I think an answer should definitely contain tricks that uses this information. Also, only certain characters are possible at the end of base 64 ciphertext (where the input in octets is not dividable by 3), further restricting the possible values. – Maarten Bodewes Jan 20 '17 at 9:35
• The key size is about ~88 bits (I think the key size is $26!$) so brute forcing is definitely out by the way. – Maarten Bodewes Jan 20 '17 at 9:41
• This question is missing which information can be assumed to be present to distinguish the result of decoding. As base64 can encode any binary you cannot decode without information about the plaintext. It would only possibly leak a tiny bit of information at the end of the base64 encoding (as the last character only encodes 2, 4 or 6 bits out of 8). – Maarten Bodewes Feb 2 '17 at 13:28
• Have you looked at this link? crypto.stackexchange.com/questions/20802/… – Carl Knox Feb 7 '17 at 14:35