tenthash

Types

pub opaque type HashState

Functions

pub fn finalise(state: HashState) -> Result(BigInt, Nil)

Finalises the hash and returns the resulting BigInt

pub fn hash(data: String) -> Result(BigInt, Nil)

Takes a String and returns a BigInt result or Error(Nil) if hash failed for some reason

Examples

let assert Ok(h) = hash("abcdefghijklmnopqrstuvwxyz")
bigi.to_String(h)
// -> "1380110527555217708541196361393927539963735354394"
pub fn hash_bitarray(data: BitArray) -> Result(BigInt, Nil)

Takes a BitArray and returns a BigInt result or Error(Nil) if hash failed for some reason

pub fn new() -> Result(HashState, Nil)

Returns a HashState to allow creating a hash using streaming

pub fn update(
  state: HashState,
  data: String,
) -> Result(HashState, Nil)

Updates the HashState using the provided String

pub fn update_bitarray(
  state: HashState,
  data: BitArray,
) -> Result(HashState, Nil)

Updates the HashState using the provided BitArray

Search Document