sha256

Calculates the SHA256 hash of the given value.

Example

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

Parameters

The value to hash. It can be either a hexadecimal string or a Uint8Array.

Type

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

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

Type

let to: TTo;

Returns

let returnType: Sha256Hash<TTo>;

The SHA256 hash of the value in the specified format.