gleamunison/crypto
Types
pub type Argon2Params {
Argon2Params(
password: BitArray,
salt: BitArray,
secret: BitArray,
ad: BitArray,
passes: Int,
memory_kib: Int,
parallelism: Int,
tag_length: Int,
)
}
Constructors
-
Argon2Params( password: BitArray, salt: BitArray, secret: BitArray, ad: BitArray, passes: Int, memory_kib: Int, parallelism: Int, tag_length: Int, )
pub type CryptoError {
InvalidInput(reason: String)
}
Constructors
-
InvalidInput(reason: String)
pub type HashAlgorithm {
Sha256
Sha512
Md5
}
Constructors
-
Sha256 -
Sha512 -
Md5
Values
pub fn argon2_h0_debug_hex(
params: Argon2Params,
) -> Result(String, CryptoError)
Test support: H0 intermediate for RFC 9106 section 5.3 cross-checks. Never call on production password material.
pub fn argon2id(
params: Argon2Params,
) -> Result(BitArray, CryptoError)
pub fn blake2b(
data: BitArray,
out_len: Int,
) -> Result(BitArray, CryptoError)
pub fn blake2b_hex(
data: BitArray,
out_len: Int,
) -> Result(String, CryptoError)
pub fn hash(
algo: HashAlgorithm,
data: BitArray,
) -> Result(BitArray, CryptoError)
pub fn hash_hex(
algo: HashAlgorithm,
data: BitArray,
) -> Result(String, CryptoError)
pub fn hmac(
algo: HashAlgorithm,
key: BitArray,
data: BitArray,
) -> Result(BitArray, CryptoError)
pub fn random_bytes(n: Int) -> BitArray
pub fn secure_compare(a: BitArray, b: BitArray) -> Bool
Constant-time comparison (for tag verification).