Expand description
Utilities for encoding, decoding, and displaying lowercase hex/base16 formatted data.
Encoding and decoding is also designed to be (likely) constant time (as much as we can without diving into manual assembly), which allows us to safely hex::encode and hex::decode secrets without potentially leaking bits via timing side channels.
Structs§
- HexDisplay
- Provides
DebugandDisplayimpls for a byte slice. Useful for displaying hex value without allocating viaencode.
Enums§
- Decode
Error - Errors which can be produced while decoding a hex string.
Traits§
- FromHex
- A trait to deserialize something from a hex-encoded string slice.
Functions§
- decode
- Try to decode a hex string to owned bytes (
Vec<u8>). - decode_
const - A
const fnto decode a hex string to a fixed-length array at compile time. Panics if the input was not a valid hex string. - decode_
to_ slice - Decodes a hex string into an output buffer. This is also designed to be (likely) constant time.
- display
- Get a
HexDisplaywhich provides aDebugandDisplayimpl for the given byte slice. Useful for displaying a hex value without allocating. - encode
- Convert a byte slice to an owned hex string. If you simply need to display a
byte slice as hex, use
displayinstead, which avoids the allocation.