-
-
Notifications
You must be signed in to change notification settings - Fork 71
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
feat(encoding): introduce Base64\Variant
enum to support encoding/decoding different variants
#408
Conversation
issue azjezz#407 This commit introduces functions url_encode and url_decode in Psl\Encoding\Base64 namespace. Following rfc4648 it uses base64url alphabet to make base64 encoding url safe.
Base64\url_encode
and Base64\url_decode
functions
Co-authored-by: Saif Eddin Gmati <29315886+azjezz@users.noreply.github.com>
Pull Request Test Coverage Report for Build 5281085370
💛 - Coveralls |
In Base64 namespace: For both encode and url_encode, add bool $padding arg to tell if we have or not padding at the end. By default encode is set to true and url_encode to false. For both decode and url_decode, add bool $explicitPadding arg to tell if we check or not padding at the end. By default decode is set to true and url_decode to false.
Run doc/documenter.php
In goal to do dot slash [ordered] encoding, refactor base64 encoding with inspiration from ParagonIE (https://github.com/paragonie/constant_time_encoding).
@veewee do you think this should start a new major branch ( 3.x ), or should we allow this BC break to go through? we have before release a minor with a bc break in a non major component, so that won't be new :) |
@azjezz the way I see this, is that the public signature of the method did not change in a breaking way. The only thing that changed is extra optional arguments and the internal implementation. Do we need to benchmark the implementation vs PHPs implementation to make sure it's similarly performant and produces the same results? |
It did though, we added new |
we can, but keep in mind that this implementation while slower ( not sure by how much ), provides constant time encoding/decoding, which the PHP implementation does not provide. |
Previously we did not provide any padding options though. It was just the encoding/encoded arg |
never mind me then :) my brain is not working right. |
@Gashmob aside from the comments above, this looks great to me 💪 we can ship it in the next minor soon. |
Base64\url_encode
and Base64\url_decode
functionsBase64\Variant
enum to support encoding/decoding different variants
Ok, I've applied your suggestions and fix errors from checks. Normally all it's done, clean, good 😄 |
awesome work @Gashmob ! thank you for contributing 🎉 |
Closes issue #407
This pr introduces functions
url_encode
andurl_decode
inPsl\Encoding\Base64
namespace. Following rfc4648 it uses base64url alphabet to make base64 encoding url safe.