-
Notifications
You must be signed in to change notification settings - Fork 12
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
base64url #4
Comments
I might be able to use a similar approach to what I did in in the CSV parser of product-collections to simplify the usage. |
I'm not sure about use cases. Whether people need to have lib that does both, or have two slightly small libs that can do one each? I think second option is more likely. People either prefer "classic" base64 or base64url, and only need to have one. |
Commit 3e17910 should suffice. |
I think there is also a need of option to omit padding. Or even make it off by default in base64url. |
I re read the rfc and I'm not convinced:
My current implementation has the decode table recomputed at each decode. I'll fix this shortly by encapsulating B64Scheme in it's own class. It would be possible to put padding into this class but I don't think there's much use for unpadded base64... |
base64url is supposed to be used in URLs, therefore omission of usual reserved characters. http://tools.ietf.org/html/rfc3986#section-3.4 URI producing applications often use the reserved characters allowed in a segment to delimit |
The problem is that if padding is omitted the encoding is non canonical. The RFC suggests percent encoding the "=" character.
I guess the padding could be stripped:
And if wanted to disable it I'd do something like this:
Then substitute 'pad' for 3 in the rest of the code. |
I'll push branch "nopadding" shortly:
You'll see the issue with non-canonical encoding. |
Thing to consider. There are more than one standards of base64. base64url, for example, is increasingly popular, because it makes embedding it in urls easier.
You may want to add support for base64url to your lib, unless you consider it too much bloat.
The text was updated successfully, but these errors were encountered: