Skip to content

Conversation

@lemire
Copy link
Member

@lemire lemire commented Dec 4, 2025

@erikcorry recently remarked that the maximal_binary_length_from_base64 could be confusing. This PR attempts to better document it and justify how it works.

The contract is thus:

  1. Constant time execution (very fast).
  2. Exact result if there is no ignorable characters (spaces, linefeed...).
  3. Exact result even if there are padding characters

The reason why it is reasonable is that most base64 inputs have very few ignorable characters. And if you add lots and lots of spaces to your base64 payloads, you are probably not focused on minimizing memory usage.

@lemire
Copy link
Member Author

lemire commented Dec 4, 2025

@erikcorry what do you think?

@lemire lemire requested a review from pauldreik December 15, 2025 22:38
@pauldreik
Copy link
Collaborator

looks good!

@lemire lemire merged commit 8f29162 into master Dec 16, 2025
70 checks passed
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.

4 participants