# Is there any identification for common encoding/encryption?

I come across lots of tokens which might be simply encoded and not random, but I don't know any way to identity if they are encoded or random, how to find is there any cheatsheet for the same.

For example, I know about base64 encoding, I can tell just by looking if its base64 or not. Identification for base64 is it would be in pair of 3 so total count of the characters would be in multiple for 3, if for some reason say there are 19 characters then to make it multiple of 3 two "=" (without quotes) would be added at the end.

Like this are you aware about identification of other encoding/encryption?

• They could have used any permutation of the base64 alphabet. I've seen cases where the order was random, so even base64 can have a secret key element... – Henno Brandsma Apr 16 at 6:11
• Is there any identification chart or kind of a cheatsheet to identify most common enconding/encryption ? – Rootrj Apr 16 at 7:27
• Traditional base64 (PEM or MIME including S/'MIME and some XML and also PGP) is padded with equals to a multiple of 4 chars (corresponding to 3 octets binary), but uuencode uses either space or grave/backtick as well as a length prefix and there are variations of base64 that are not padded at all. – dave_thompson_085 Apr 28 at 4:43

You can use heuristics to determine the type of encoding, but even then you cannot always tell e.g. base 64 from encrypted base 64, or even base 64 from hex (ABCD is both valid in base 64 and hex, to name just one example). It is also generic text. Even if you determined that something is base 64 encoded then you'd be not much further. You can decode the binary value inside, but now you'd have to test what kind of value it represents.
There are of course encodings that explicitly tell you what they are, such as PEM or XML encoded keys. ASN.1 / BER encoding is used a lot so testing if it complies with that is always a good idea. EC public keys (also used for ECIES encryption) commonly start with a byte valued 02, 03 or 04 and so on and so forth. PGP container format is usually easy to distinguish as well.