exth_crypto v0.1.2 ExthCrypto.Hash.Keccak

Simple wrapper for Keccak function for Ethereum.

Note: This module defines KECCAK as defined by Ethereum, which differs slightly than that assigned as the new SHA-3 variant. For SHA-3, a few constants have been changed prior to adoption by NIST, but after adoption by Ethereum.

Link to this section Summary

Functions

Returns the keccak sha256 of a given input

Link to this section Types

Link to this type keccak_hash()
keccak_hash() :: ExthCrypto.hash

Link to this section Functions

Link to this function kec(data)
kec(binary) :: keccak_hash

Returns the keccak sha256 of a given input.

Examples

iex> ExthCrypto.Hash.Keccak.kec("hello world")
<<71, 23, 50, 133, 168, 215, 52, 30, 94, 151, 47, 198, 119, 40, 99,
  132, 248, 2, 248, 239, 66, 165, 236, 95, 3, 187, 250, 37, 76, 176,
  31, 173>>

iex> ExthCrypto.Hash.Keccak.kec(<<0x01, 0x02, 0x03>>)
<<241, 136, 94, 218, 84, 183, 160, 83, 49, 140, 212, 30, 32, 147, 34,
  13, 171, 21, 214, 83, 129, 177, 21, 122, 54, 51, 168, 59, 253, 92,
  146, 57>>