Module utils

Module utils 

Source
Expand description

Utility functions for data manipulation.

This module provides helper functions for encoding, decoding, and secure memory operations.

Functionsยง

bytes_to_int_be
Convert big-endian bytes to an integer.
bytes_to_int_le
Convert little-endian bytes to an integer.
concat
Concatenate multiple byte slices.
from_base64
Convert base64 string to bytes.
from_base64url
Convert URL-safe base64 string to bytes.
from_hex
Convert hexadecimal string to bytes.
int_to_bytes_be
Convert an integer to big-endian bytes.
int_to_bytes_le
Convert an integer to little-endian bytes.
pad_pkcs7
Apply PKCS#7 padding.
secure_clear
Securely zero a vector and clear it.
secure_compare
Constant-time comparison of two byte slices.
secure_zero
Securely zero a byte slice.
to_base64
Convert bytes to base64 string.
to_base64url
Convert bytes to URL-safe base64 string (no padding).
to_hex
Convert bytes to hexadecimal string.
to_hex_upper
Convert bytes to uppercase hexadecimal string.
try_xor_bytes
Try to XOR two byte slices, returning an error if lengths differ.
unpad_pkcs7
Remove PKCS#7 padding.
xor_bytes
XOR two byte slices of equal length.