Cryptographic hashing, base64 encoding and decoding helpers.
Enumerations | |
| enum class | Pad { kWith , kWithout } |
Functions | |
| std::string | Base64Encode (std::string_view data, Pad pad=Pad::kWith) |
| Encodes data to Base64, add padding by default. | |
| std::string | Base64Decode (std::string_view data) |
| Decodes data from Base64, padding is optional, line breaks are skipped, unused bits of the last character are ignored. | |
| std::string | Base64UrlEncode (std::string_view data, Pad pad=Pad::kWith) |
| Encodes data to Base64 (using URL alphabet), add padding by default. | |
| std::string | Base64UrlDecode (std::string_view data) |
| Decodes data from Base64 (using URL alphabet), padding is optional, line breaks are skipped, unused bits of the last character are ignored. | |
| bool | Base64UniversalDecodeInPlace (std::string &data) noexcept |
| Decodes data in-place and returns true on success. | |
|
strong |
Definition at line 15 of file base64.hpp.
| std::string crypto::base64::Base64Decode | ( | std::string_view | data | ) |
Decodes data from Base64, padding is optional, line breaks are skipped, unused bits of the last character are ignored.
| CryptoException | if data contains other characters outside of the alphabet (including spaces and the URL alphabet), '=' not at the end, more than two '=' or if the number of characters before '=' is 1 modulo 4 |
| std::string crypto::base64::Base64Encode | ( | std::string_view | data, |
| Pad | pad = Pad::kWith ) |
Encodes data to Base64, add padding by default.
| data | binary data to encode |
| pad | controls if pad should be added or not |
| CryptoException | internal library exception |
|
nodiscardnoexcept |
Decodes data in-place and returns true on success.
| std::string crypto::base64::Base64UrlDecode | ( | std::string_view | data | ) |
Decodes data from Base64 (using URL alphabet), padding is optional, line breaks are skipped, unused bits of the last character are ignored.
| CryptoException | if data contains other characters outside of the URL alphabet (including spaces and the standard alphabet), '=' not at the end, more than two '=' or if the number of characters before '=' is 1 modulo 4 |
| std::string crypto::base64::Base64UrlEncode | ( | std::string_view | data, |
| Pad | pad = Pad::kWith ) |
Encodes data to Base64 (using URL alphabet), add padding by default.
| data | binary data to encode |
| pad | controls if pad should be added or not |
| CryptoException | internal library exception |