Functions for encoding/decoding of strings in Base64 format. More...
Functions | |
| SIMD_API void | SimdBase64Decode (const uint8_t *src, size_t srcSize, uint8_t *dst, size_t *dstSize) |
| Decodes a Base64-encoded byte sequence into its original binary data. More... | |
| SIMD_API void | SimdBase64Encode (const uint8_t *src, size_t size, uint8_t *dst) |
| Encodes binary data into a Base64 string. More... | |
| SIMD_INLINE std::string | Base64Decode (const std::string &src) |
| Decode string to Base64. More... | |
| SIMD_INLINE std::string | Base64Encode (const std::string &src) |
| Encode string to Base64. More... | |
Detailed Description
Functions for encoding/decoding of strings in Base64 format.
Function Documentation
◆ SimdBase64Decode()
| void SimdBase64Decode | ( | const uint8_t * | src, |
| size_t | srcSize, | ||
| uint8_t * | dst, | ||
| size_t * | dstSize | ||
| ) |
Decodes a Base64-encoded byte sequence into its original binary data.
The function decodes a Base64-encoded input (as defined by RFC 4648) into the original binary data. The input length must be a multiple of 4 and at least 4 bytes. Padding characters ('=') at the end of the input are handled automatically, so the actual decoded length may be 1 or 2 bytes less than srcSize / 4 * 3.
- Note
- This function has a C++ wrapper std::string Simd::Base64Decode(const std::string & src).
- Parameters
-
[in] src - a pointer to the Base64-encoded input data. Its length must be a multiple of 4 and at least 4. [in] srcSize - a size (in bytes) of the Base64-encoded input. Must be a non-zero multiple of 4. [out] dst - a pointer to the output buffer for the decoded binary data. The buffer size must be at least srcSize / 4 * 3 bytes. [out] dstSize - a pointer to a variable that receives the number of bytes written to the output buffer.
◆ SimdBase64Encode()
| void SimdBase64Encode | ( | const uint8_t * | src, |
| size_t | size, | ||
| uint8_t * | dst | ||
| ) |
Encodes binary data into a Base64 string.
The function encodes arbitrary binary data into its Base64 representation (as defined by RFC 4648). Every 3 input bytes are encoded as 4 Base64 characters. If the input length is not a multiple of 3, the output is padded with '=' characters to the next multiple of 4. The output is NOT null-terminated; its length is exactly (size + 2) / 3 * 4 bytes.
- Note
- This function has a C++ wrapper std::string Simd::Base64Encode(const std::string & src).
- Parameters
-
[in] src - a pointer to the input binary data to be encoded. [in] size - a size (in bytes) of the input data. [out] dst - a pointer to the output buffer for the Base64-encoded string. The buffer size must be at least (size + 2) / 3 * 4 bytes.
◆ Base64Decode()
| std::string Base64Decode | ( | const std::string & | src | ) |
Decode string to Base64.
- Note
- This function is a C++ wrapper for function SimdBase64Decode.
- Parameters
-
[in] src - an input Base64 encoded string.
- Returns
- the output decoded string.
◆ Base64Encode()
| std::string Base64Encode | ( | const std::string & | src | ) |
Encode string to Base64.
- Note
- This function is a C++ wrapper for function SimdBase64Encode.
- Parameters
-
[in] src - an input original string.
- Returns
- the output Base64 encoded string.