Crate commonware_utils

Source
Expand description

Leverage common functionality across multiple primitives.

Structs§

PrioritySet
A set that offers efficient iteration over its elements in priority-ascending order.

Traits§

SystemTimeExt
Extension trait to add methods to std::time::SystemTime

Functions§

from_hex
Converts a hexadecimal string to bytes.
from_hex_formatted
Converts a hexadecimal string to bytes, stripping whitespace and/or a 0x prefix. Commonly used in testing to encode external test vectors without modification.
hash
Hashes the given Bytes using SHA-256.
hex
Converts bytes to a hexadecimal string.
max_faults
Compute the maximum value of f (faults) that can be tolerated given n = 3f + 1.
modulo
Compute the modulo of bytes interpreted as a big-endian integer.
quorum
Assuming that n = 3f + 1, compute the minimum size of q such that q >= 2f + 1.
union
Computes the union of two byte slices.
union_unique
Concatenate a namespace and a message, prepended by a varint encoding of the namespace length.