agnoster / base32-js

Base32 encoding for JavaScript, based (loosely) on Crockford's Base32
https://github.com/agnoster/base32-js
MIT License
121 stars 61 forks source link

NOT CROCKFORD COMPATIBLE #23

Open bbourdel opened 5 years ago

bbourdel commented 5 years ago

Please : why did you use the U instead of S ?

The crockford alpahbeth is : 0123456789abcdefghjkmnpqrstvwxyz The one you use is : 0123456789abcdefghjkmnpqrtuvwxyz Not the S is not present in your alphabet and the U is present.

This is not the Crockford Base32 correct implementation : source : https://en.wikipedia.org/wiki/Base32 and https://www.crockford.com/base32.html and all other package in all other language (ie Python for my backend....) I've lost 4 hours to figure out what's happened ....

mnp commented 5 years ago

It's also emitting ones "1" and zeros "0".

bbourdel commented 5 years ago

This is normal. Here the Crockford32 official specification : https://www.crockford.com/base32.html 0, O, o can be decoded as the same value 0x00, but the value 0x00 is alwais encoded as 0 (zero)


De : Mitchell Perilstein notifications@github.com Envoyé : lundi 1 juillet 2019 00:04 À : agnoster/base32-js Cc : bbourdel; Author Objet : Re: [agnoster/base32-js] NOT CROCKFORD COMPATIBLE (#23)

It's also emitting ones "1" and zeros "0".

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/agnoster/base32-js/issues/23?email_source=notifications&email_token=ACKWBYVDUIYCTNU3KFJHVIDP5EUYPA5CNFSM4HBQAY32YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODY4UWHY#issuecomment-507071263, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ACKWBYTZFDMBNSMN7U2E6XTP5EUYPANCNFSM4HBQAY3Q.

alexp1917 commented 3 years ago

I dont know if this is the same issue, but in case it is, here's another example where this library disagrees with linux tools and the competing top result (hi-base32?)

echo '6cf477f57dcfbaa61275d336c3ba2fc7dd28ecee18a4f20c004732878d7d' | xxd -r -p | base32
# prints NT2HP5L5Z65KMETV2M3MHORPY7OSR3HODCSPEDAAI4ZIPDL5

and then this unexpected result:

#!/usr/bin/env node
var base32 = require('base32');

var echo = '6cf477f57dcfbaa61275d336c3ba2fc7dd28ecee18a4f20c004732878d7d'
var xxdStep = Buffer.from(echo, 'hex');
//xxdStep = xxdStep.toString();
var b32 = base32.encode(xxdStep);

console.log(b32);
// prints dku7fxbxtyxac4knucvc7ehfrzejhv7e32jf43008wt8f3bx

I mean granted this library has a disclaimer on it, and im grateful for that or else i would have spent even more time figuring this out