Crate hex_string

Source
Expand description

A utilty library for handling Hex strings

The digest operations in sha2 return the result as u8 vectors. But a lot of command line applicaions, like sha256sum, return byte strings. I was unable to find an obvious way to handle this in rust, so this module provides a clear well-defined HexString, loaders from a regular string of hex values and from a vector of bytes, and output representations in both forms.

Structs§

HexString
HexString provides a structured representation of a hex string. It is guaranteed to be a valid string, whether initialized from a string or from a byte vector.

Enums§

HexStringError

Functions§

hexchar_to_nibble
Given a character, convert it into a u8 in the range 0-15 (inclusive).
nibble_to_hexchar
Given a nibble (a u8 value in the range 0-15), convert it to its corresponding character representation.
u8_to_hex_string
Convert a byte to its two-character hex string representation