Skip to content

Don't double-encode in urlsafe_base64 - #13

Open
cheerfulstoic wants to merge 1 commit into
patricksrobertson:masterfrom
cheerfulstoic:patch-1
Open

Don't double-encode in urlsafe_base64#13
cheerfulstoic wants to merge 1 commit into
patricksrobertson:masterfrom
cheerfulstoic:patch-1

Conversation

@cheerfulstoic

Copy link
Copy Markdown

I tried using this function and the results were longer than they should have been. This was because it was encoding to standard base64 and then re-encoding that to URL-safe base64. This change fixes that

I tried using this function and the results were longer than they should have been.  This was because it was encoding to standard base64 and then re-encoding *that* to URL-safe base64.  This change fixes that
halostatue added a commit to KineticCafe/secure_random that referenced this pull request Jul 15, 2024
The test assumes 22 byte default, but had 32 because it was double-base64 encoding (once
regular, and once URL-safe). Without the double encoding, the tests fail because they were
expecting 32 (then 24), but the intent was URL-safe base encoding without padding.

Originally based on patricksrobertson#13, but fixes the tests and
padding.
halostatue added a commit to KineticCafe/secure_random that referenced this pull request Jul 16, 2024
The test assumes 22 byte default, but had 32 because it was double-base64 encoding (once
regular, and once URL-safe). Without the double encoding, the tests fail because they were
expecting 32 (then 24), but the intent was URL-safe base encoding without padding.

Originally based on patricksrobertson#13, but fixes the tests and
padding.
@dingosky

dingosky commented Sep 1, 2025

Copy link
Copy Markdown

Moved description of the severity of the issue addressed by this PR to issue #16

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants