72 lines
2.6 KiB
Plaintext
72 lines
2.6 KiB
Plaintext
_title: Hashing
|
|
|
|
_section: Hashing Algorithms
|
|
|
|
Explain what hash functions are?
|
|
|
|
|
|
_subsection: Cryptographic Hashing
|
|
|
|
The [Cryptographic Hash Functions](https://en.wikipedia.org/wiki/Cryptographic_hash_function)
|
|
are a specific family of hash functions.
|
|
|
|
_property: utils.keccak256(aBytesLike) => string
|
|
Returns the [KECCAK256](https://en.wikipedia.org/wiki/SHA-3) digest //aBytesLike//.
|
|
|
|
_property: utils.ripemd160(aBytesLike) => string
|
|
Returns the [RIPEMD-160](https://en.m.wikipedia.org/wiki/RIPEMD) digest of //aBytesLike//.
|
|
|
|
_property: utils.sha256(aBytesLike) => string
|
|
Returns the [SHA2-256](https://en.wikipedia.org/wiki/SHA-2) digest of //aBytesLike//.
|
|
|
|
_property: utils.sha512(aBytesLike) => string
|
|
Returns the [SHA2-512](https://en.wikipedia.org/wiki/SHA-2) digest of //aBytesLike//.
|
|
|
|
_property: utils.computeHmac(algorithm, key, data) => string
|
|
Returns the [HMAC](https://en.wikipedia.org/wiki/HMAC) of //data// with //key//
|
|
using the [Algorithm](supported-algorithm) //algorithm//.
|
|
|
|
|
|
_heading: HMAC Supported Algorithms @<supported-algorithm>
|
|
|
|
_property: utils.SupportedAlgorithms.sha256
|
|
Use the [SHA2-256](https://en.wikipedia.org/wiki/SHA-2) hash algorithm.
|
|
|
|
_property: utils.SupportedAlgorithms.sha512
|
|
Use the [SHA2-512](https://en.wikipedia.org/wiki/SHA-2) hash algorithm.
|
|
|
|
|
|
_subsection: Common Hashing Helpers
|
|
|
|
_property: utils.hashMessage(message) => string
|
|
Computes the Ethereum message digest of //message//. Ethereum messages are
|
|
converted to UTF-8 bytes and prefixed with ``\x19Ethereum Signed Message:``
|
|
and the length of //message//.
|
|
|
|
_property: utils.id(text) => string
|
|
The Ethereum Identity function computs the keccak256 hash of the //text// bytes.
|
|
|
|
_property: utils.namehash(name) => string
|
|
Returns the [ENS Namehash](https://docs.ens.domains/contract-api-reference/name-processing#hashing-names) of //name//.
|
|
|
|
|
|
_subsection: Solidity Hashing Algorithms
|
|
|
|
When using the Solidity ``abi.packEncoded(...)`` function, a non-standard
|
|
//tightly packed// version of encoding is used. These functions implement
|
|
the tightly packing algorithm.
|
|
|
|
_property: utils.solidityPack(arrayOfTypes, arrayOfValues) => string
|
|
Returns the non-standard encoded //arrayOfValues// packed according to
|
|
their respecive type in //arrayOfTypes//.
|
|
|
|
_property: utils.solidityKeccak256(arrayOfTypes, arrayOfValues) => string
|
|
Returns the KECCAK256 of the non-standard encoded //arrayOfValues// packed
|
|
according to their respective type in //arrayOfTypes//.
|
|
|
|
_property: utils.soliditySha256(arrayOfTypes, arrayOfValues) => string
|
|
Returns the SHA2-256 of the non-standard encoded //arrayOfValues// packed
|
|
according to their respective type in //arrayOfTypes//.
|
|
|
|
|