[−][src]Crate b64ct
Pure Rust implementation of "B64" encoding, a minified subset of the standard Base64 encoding (RFC 4648, section 4) used by the PHC string format.
Omits padding (=
) as well as extra whitespace, as described in the PHC string
format specification:
https://github.com/P-H-C/phc-string-format/blob/master/phc-sf-spec.md#b64
Supports the Base64 character subset: [A-Z]
, [a-z]
, [0-9]
, +
, /
Implemented without data-dependent branches or look up tables, thereby providing "best effort" constant-time operation. Adapted from the following constant-time C++ implementation of Base64:
https://github.com/Sc00bz/ConstTimeEncoding/blob/master/base64.cpp
Copyright (c) 2014 Steve "Sc00bz" Thomas (steve at tobtu dot com). Derived code is dual licensed MIT + Apache 2 (with permission from Sc00bz).
Enums
Error | "B64" encoding errors. |
Functions
decode | "B64" decode the given source byte slice into the provided destination buffer. |
decode_vec | alloc Decode a "B64"-encoded string into a byte vector. |
decoded_len | Get the length of the output from decoding the provided "B64"-encoded input. |
encode | Encode the input byte slice as "B64", writing the result into the provided destination slice, and returning an ASCII-encoded string value. |
encode_string | alloc Encode the input byte slice as a "B64"-encoded |
encoded_len | Get the "B64"-encoded length of the given byte slice. |