Module extra::cryptoutil

Structs

FixedBuffer128

A fixed size buffer of 128 bytes useful for cryptographic operations.

FixedBuffer64

A fixed size buffer of 64 bytes useful for cryptographic operations.

Traits

FixedBuffer

A FixedBuffer, likes its name implies, is a fixed size buffer. When the buffer becomes full, it must be processed. The input() method takes care of processing and then clearing the buffer automatically. However, other methods do not and require the caller to process the buffer. Any method that modifies the buffer directory or provides the caller with bytes that can be modifies results in those bytes being marked as used by the buffer.

StandardPadding

The StandardPadding trait adds a method useful for various hash algorithms to a FixedBuffer struct.

Functions

add_bytes_to_bits

Adds the specified number of bytes to the bit count. fail!() if this would cause numeric overflow.

add_bytes_to_bits_tuple

Adds the specified number of bytes to the bit count, which is a tuple where the first element is the high order value. fail!() if this would cause numeric overflow.

read_u32v_be

Read a vector of bytes into a vector of u32s. The values are read in big-endian format.

read_u32v_le

Read a vector of bytes into a vector of u32s. The values are read in little-endian format.

read_u64v_be

Read a vector of bytes into a vector of u64s. The values are read in big-endian format.

write_u32_be

Write a u32 into a vector, which must be 4 bytes long. The value is written in big-endian format.

write_u32_le

Write a u32 into a vector, which must be 4 bytes long. The value is written in little-endian format.

write_u64_be

Write a u64 into a vector, which must be 8 bytes long. The value is written in big-endian format.