Cartouche.Hash (Cartouche v0.2.0)

Copy Markdown View Source

Keccak-256 helpers for hashing arbitrary binaries.

Returns either the 32-byte binary digest (keccak/1) or its unsigned integer interpretation (keccak_unsigned/1).

Summary

Functions

Returns the keccak of the given binary message.

Returns the keccak of the given binary message, as an unsigned.

Functions

keccak(message)

@spec keccak(binary()) :: <<_::256>>

Returns the keccak of the given binary message.

Examples

iex> use Cartouche.Hex iex> Cartouche.Hash.keccak("test") ~h[0x9C22FF5F21F0B81B113E63F7DB6DA94FEDEF11B2119B4088B89664FB9A3CB658]

keccak_unsigned(message)

@spec keccak_unsigned(binary()) :: non_neg_integer()

Returns the keccak of the given binary message, as an unsigned.

Examples

iex> Cartouche.Hash.keccak_unsigned("test") 70622639689279718371527342103894932928233838121221666359043189029713682937432