Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

LibKeccak256

Git Source

Functions

hashBytes

Hash a variable-length byte array.

function hashBytes(bytes memory b) internal pure returns (bytes32 result);

Parameters

NameTypeDescription
bbytesThe byte array

hashBlock

Hash a data block at a given index and of a given size.

If the data block is too large, an out-of-memory error might be raised.

If the data block index is too big, an arithmetic error might be raised.

function hashBlock(bytes memory data, uint256 dataBlockIndex, uint256 dataBlockSize)
    internal
    pure
    returns (bytes32 result);

Parameters

NameTypeDescription
databytesThe data
dataBlockIndexuint256The data block index
dataBlockSizeuint256The data block size

hashPair

Hash a pair of 32-byte values.

Equivalent to keccak256(abi.encode(a, b)).

Uses assembly to avoid memory allocation or expansion.

function hashPair(bytes32 a, bytes32 b) internal pure returns (bytes32 result);