Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for Base32 decoding #10

Open
evandrix opened this issue Apr 8, 2018 · 4 comments
Open

add support for Base32 decoding #10

evandrix opened this issue Apr 8, 2018 · 4 comments

Comments

@evandrix
Copy link

evandrix commented Apr 8, 2018

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.

@s0md3v
Copy link
Owner

s0md3v commented Apr 8, 2018

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

@caffeinatedMike
Copy link

caffeinatedMike commented Apr 8, 2018

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.

@3lixy
Copy link

3lixy commented Apr 9, 2018

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

@s0md3v
Copy link
Owner

s0md3v commented Apr 9, 2018

@3lixy We will decode for both ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants