-
Notifications
You must be signed in to change notification settings - Fork 6
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!: add padding support & make it optional #21
Conversation
88cbfda
to
a5d4afd
Compare
|
This seems to be a github bug that I have seen happen before as well - closing the PR and opening again fixes it sometimes. Let me try Update: No, didnt work. I will check this, but for the other issue, maybe we can try upgrading to 0.36 now? |
72c090d
to
10100a1
Compare
I've updated the branch protection rules so this PR can go through. @saleel can you review? |
src/encoder.nr
Outdated
// handle padding | ||
let rem = InputBytes % 3; | ||
if (rem == 1) { | ||
result[base64_offset + num_elements_in_final_chunk - 1] = BASE64_PADDING_CHAR; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this could be result[OutputElements - 1] = BASE64_PADDING_CHAR;
along with something like assert((InputBytes + 2) / 3 * 4 == OutputElements);
at the top.
feat: optimize optional padding
chore: improve encode length calc
Description
This PR makes it possible to handle encoding/decoding of correctly padding base64 (which previously wasn't supported) or to optionally encode/decode base64 for which the padding has already been stripped.
Additionally, this PR again reformats to the most updated version.
Problem*
The standard encoding for base64 specifies padding, which isn't handled in this library and may be needed in some cases by default. However, since it will be more efficient without handling padding in cases where that's available, it's nice to make this optional
Summary*
Additional Context
PR Checklist*
cargo fmt
on default settings. (used nargo fmt)