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

which variant of Base64 is officially supported? #5239

Closed
tristanls opened this issue Feb 15, 2016 · 1 comment
Closed

which variant of Base64 is officially supported? #5239

tristanls opened this issue Feb 15, 2016 · 1 comment
Labels
buffer Issues and PRs related to the buffer subsystem. question Issues that look for answers.

Comments

@tristanls
Copy link
Contributor

Hi,

I noticed that new Buffer(str, "base64") accepts both RFC 3548 (+,/) encoding as well as RFC 4648 (-,_) encoding:

(node v5.6.0)
> a
'lCH34wWsR0Ap3KsGZQfIpJKid73f7bbkdPBkX7CV8zukgF-K__H2CKVD'
> b
'lCH34wWsR0Ap3KsGZQfIpJKid73f7bbkdPBkX7CV8zukgF+K//H2CKVD'
> new Buffer(a, "base64").equals(new Buffer(b, "base64"));
true

According to RFC 4648:

[-,_] encoding may be referred to as "base64url". This encoding
should not be regarded as the same as the "base64" encoding and
should not be referred to as only "base64". Unless clarified
otherwise, "base64" refers to the base 64 in the previous section.

I prefer the "base64url" encoding, so I'm not asking to have it removed. But I would like to know if this is "officially" supported as part of the API and is not going to change moving forward? I didn't find anything in the documentation.

@mscdex mscdex added question Issues that look for answers. buffer Issues and PRs related to the buffer subsystem. labels Feb 15, 2016
@bnoordhuis
Copy link
Member

Yes, they're both supported and they have been since practically from the beginning. It won't go away.

If you want to have it documented to make it official, pull requests welcome. Just make sure you follow CONTRIBUTING.md. :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
buffer Issues and PRs related to the buffer subsystem. question Issues that look for answers.
Projects
None yet
Development

No branches or pull requests

3 participants