gleamunison/crypto

Types

pub type CryptoError {
  InvalidInput(reason: String)
}

Constructors

  • InvalidInput(reason: String)
pub type HashAlgorithm {
  Sha256
  Sha512
  Md5
}

Constructors

  • Sha256
  • Sha512
  • Md5

Values

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
Search Document