Polkadot Apps
    Preparing search index...
    • Compute a 32-byte SHA2-256 hash.

      Used by bulletin-deploy and supported by the Bulletin Chain as an alternative hashing algorithm.

      Parameters

      • data: Uint8Array

        Arbitrary bytes to hash.

      Returns Uint8Array

      32-byte SHA2-256 digest.

      import { sha256, bytesToHex } from "@polkadot-apps/utils";

      const hash = sha256(new TextEncoder().encode("hello"));
      console.log(bytesToHex(hash)); // 64-char hex string