Skip to content

@hash

Compute the hash of a string with keccak256 (default) or sha256.

Returns: bytes32

@hash(text algorithm?)
NameTypeDescription
textstringString to hash (e.g. a function signature)
[algorithm]stringkeccak256 (default) or sha256
# Compute a function selector
set $sel @hash("transfer(address,uint256)")
# Hash with sha256 instead of keccak256
set $digest @hash("an example" sha256)