Skip to main content

keccak256Wrapper

Callable

  • keccak256Wrapper(data: string | number | bigint | Uint8Array | readonly number[]): string

  • A wrapper for ethereum-cryptography/keccak256 to allow hashing a string and a bigint in addition to UInt8Array

    @example
    console.log(web3.utils.keccak256Wrapper('web3.js'));
    > 0x63667efb1961039c9bb0d6ea7a5abdd223a3aca7daa5044ad894226e1f83919a

    console.log(web3.utils.keccak256Wrapper(1));
    > 0xc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6

    console.log(web3.utils.keccak256Wrapper(0xaf12fd));
    > 0x358640fd4719fa923525d74ab5ae80a594301aba5543e3492b052bf4598b794c

    Parameters

    • data: string | number | bigint | Uint8Array | readonly number[]

      the input to hash

    Returns string

    • the Keccak-256 hash of the input