Skip to content

Hash.sha256

Calculates the Sha256 hash of a Bytes.Bytes or Hex.Hex value.

This function is a re-export of sha256 from @noble/hashes, an audited & minimal JS hashing library.

Imports

Named
import { Hash } from 'ox'

Examples

import { Hash } from 'ox'
 
Hash.sha256('0xdeadbeef')
// '0x5f78c33274e43fa9de5659265c1d917e25c03722dcb0b8d27db8d5feaa813953'

Definition

function sha256<value, as>(
  value: value | Hex.Hex | Bytes.Bytes,
  options?: sha256.Options<as>,
): sha256.ReturnType<as>

Source: src/core/Hash.ts

Parameters

value

  • Type: value | Hex.Hex | Bytes.Bytes

Bytes.Bytes or Hex.Hex value.

options

  • Type: sha256.Options<as>
  • Optional

Options.

options.as

  • Type: "Bytes" | "Hex" | as
  • Optional

The return type.

Return Type

Sha256 hash.

sha256.ReturnType<as>