module Eth::Util
Overview
Provides a collection of utilities for convenience, e.g., to bind relevant hashing algorithms.
Extended Modules
Defined in:
eth/util.crInstance Method Summary
-
#keccak(data : Num | Bytes | String, entropy = 256) : Num
Operating a Keccak hash on a binary/number or string literal.
Instance Method Detail
Operating a Keccak hash on a binary/number or string literal.
Parameters:
data
(Num | Bytes | String
): the binary numeric or string literal to be hashed.entropy
(Int32
): the required entropy (default256
).
Returns a Num
representing the Keccak hash.
Util.keccak(Num.new "0xdeadbeef").hex
# => "d4fd4e189132273036449fc9e11198c739161b4c0116a9a2dccdfa1c492006f1"
Util.keccak("0xdeadbeef").hex
# => "4f440a001006a49f24a7de53c04eca3f79aef851ac58e460c9630d044277c8b0"