Loading

keccak256

Scalar function

Computes the Keccak-256 hash used across the EVM toolchain, returning a BYTES32 digest.

keccak256(VARCHAR)

Accepts UTF-8 literals or 0x-prefixed hex strings and hashes the interpreted byte sequence.

Parameters

NameType
inputVARCHAR

Returns

NameType
hashBYTES32
1
SELECT keccak256(
2
'hello world' -- input
3
) AS digest;
Notebook ready in readonly mode.

keccak256(BLOB)

Hashes a single BLOB (ADDRESS, BYTES32, or raw binary) exactly as it is stored.

Parameters

NameType
dataBLOB

Returns

NameType
hashBYTES32
1
SELECT keccak256(
2
'0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045'::address -- data
3
) AS account_hash;
Notebook ready in readonly mode.

keccak256(BLOB, BLOB)

Concatenates two binary values before hashing, mirroring keccak256(abi.encodePacked(a, b)).

Parameters

NameType
leftBLOB
rightBLOB

Returns

NameType
hashBYTES32
1
SELECT keccak256(
2
'0x01'::bytes32, -- left
3
'0x02'::bytes32 -- right
4
) AS pair_digest;
Notebook ready in readonly mode.

keccak256(BLOB, BLOB, BLOB)

Hashes three BLOB inputs in order, useful for merkle branches and trie nodes.

Parameters

NameType
aBLOB
bBLOB
cBLOB

Returns

NameType
hashBYTES32
1
SELECT keccak256(
2
'0x01'::bytes32, -- a
3
'0x02'::bytes32, -- b
4
'0x03'::bytes32 -- c
5
) AS branch_digest;
Notebook ready in readonly mode.