Decodify icon indicating copy to clipboard operation
Decodify copied to clipboard

add support for Base32 decoding

Open evandrix opened this issue 7 years ago • 4 comments

it's quite common, and can be identified with 1 trailing =, instead of 2 =s used in its Base64 counterpart. in Python, base64.b32decode can be used to perform the decoding.

evandrix avatar Apr 08 '18 17:04 evandrix

Base64 doesn't always end with a = . Can you please elaborate on how to differentiate between them?

s0md3v avatar Apr 08 '18 18:04 s0md3v

You can look here for reference.

Base64

Base64 has the advantage of generating shorter representations because it uses a 64 character set instead of hexadecimal's 16. While Base 64 can use any 64 characters, many implementations follow IETF PEM RFC 1421 which specifies A-Z, a-z, 0-9, / and + while using = for padding. 

Base32

Base32, as defined in IETF RFC 3548, uses the characters A-Z and 2-7.

So, essentially, what you could look for is if the string includes any of the numbers 0, 1, 8, 9 and that should be enough to rule out the string being base32-encoded.

caffeinatedMike avatar Apr 08 '18 20:04 caffeinatedMike

try: and except may work better to implement as there probably are cases where it would detect as 64 but is actually a 32?

3lixy avatar Apr 09 '18 09:04 3lixy

@3lixy We will decode for both ;)

s0md3v avatar Apr 09 '18 11:04 s0md3v