summaryrefslogtreecommitdiff
path: root/AK/Base64.cpp
AgeCommit message (Collapse)Author
2020-11-22AK: Fix base64 decoding '/'BenJilks
When creating the lookup table, it wouldn't add the last character
2020-10-13Base64: Pre-allocate size of input and outputLenny Maiorani
Problem: - Output of decode and encode grow as the decode and encode happen. This is inefficient because a large size will require many reallocations. - `const` qualifiers are missing on variables which are not intended to change. Solution: - Since the size of the decoded or encoded message is known prior to starting, calculate the size and set the output to that size immediately. All appends will not incur the reallocation overhead. - Add `const` qualifiers to show intent.
2020-10-13Base64: constexpr initialization of alphabet and lookup tableLenny Maiorani
Problem: - The Base64 alphabet and lookup table are initialized at run-time. This results in an initial start-up cost as well as a boolean evaluation and branch every time the function is called. Solution: - Provide `constexpr` functions which initialize the alphabet and lookup table at compile-time. These can be called and assigned to a `constexpr` variable so that there is no run-time cost associated with the initialization or lookup.
2020-08-12AK: Mark compilation-unit-only functions as staticBen Wiederhake
This enables a nice warning in case a function becomes dead code. Also, add forgotten header to Base64.cpp, which would cause an issue later when we enable -Wmissing-declarations.
2020-07-27AK: Change the signature of AK::encode_base64() to use Span.asynts
2020-07-22AK: Make encode_base64 take a ByteBuffer and return a StringNico Weber
That makes the interface symmetric with decode_base64 and it's what all current callers want (except for one, which is buggy).
2020-06-18AK: Add a simple and inefficient Base64 encoderTom Lebreux
The test cases are taken from RFC 4648.
2020-04-26AK: Add a simple and inefficient Base64 decoderAndreas Kling