keccak256

Calculates the Keccak-256 hash of the given value.

Example

import { keccak256 } from "thirdweb/utils";
const hash = keccak256("0x1234");
function keccak256(
value: `0x${string}` | Uint8Array<ArrayBufferLike>,
to?: TTo,
): Keccak256Hash<TTo>;

Parameters

The value to hash, either as a hexadecimal string or a Uint8Array.

Type

let value: `0x${string}` | Uint8Array<ArrayBufferLike>;

The desired output format of the hash (optional). Defaults to 'hex'.

Type

let to: TTo;

Returns

let returnType: Keccak256Hash<TTo>;

The Keccak-256 hash of the value in the specified format.