exth_crypto v0.1.3 ExthCrypto.MAC
Wrapper for erlang’s built-in HMAC (Hash-based Message Authentication Code) and CMAC (Cipher-based Message Authentication Code) routines, to be used for Exthereum.
Link to this section Summary
Functions
Calcluates the MAC of a given set of input
Link to this section Types
Link to this section Functions
Link to this function
mac(data, key, hash_algorithm, length \\ nil)
mac(iodata, iodata, ExthCrypto.Hash.hash_algorithm, integer) :: mac
Calcluates the MAC of a given set of input.
Examples
iex> ExthCrypto.MAC.mac("The quick brown fox jumps over the lazy dog", "key", :sha256) |> ExthCrypto.Math.bin_to_hex
"f7bc83f430538424b13298e6aa6fb143ef4d59a14946175997479dbc2d1a3cd8"
iex> ExthCrypto.MAC.mac("The quick brown fox jumps over the lazy dog", "key", :sha256, 8)
<<247, 188, 131, 244, 48, 83, 132, 36>>