byte_utils 0.1.0

Utility functions for working with bytes

Crate byte_utils [] [src]

Functions

add_bytes_to_bits

Adds the specified number of bytes to the bit count. panic!() 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. panic!() if this would cause numeric overflow.

copy_memory

Copy bytes from src to dest

read_u32_be

Read the value of a vector of bytes as a u32 value in big-endian format.

read_u32_le

Read the value of a vector of bytes as a u32 value in little-endian format.

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.

read_u64v_le

Read a vector of bytes into a vector of u64s. The values are read in little-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_u32v_le

Write a vector of u32s into a vector of bytes. The values are 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.

write_u64_le

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

write_u64v_be

Write a vector of u64s into a vector of bytes. The values are written in little-endian format.

write_u64v_le

Write a vector of u64s into a vector of bytes. The values are written in little-endian format.

xor_keystream

XOR plaintext and keystream, storing the result in dst.

zero

Zero all bytes in dst