Skip to content

hash()

SIP Protocol API Reference v0.9.0


SIP Protocol API Reference / hash

hash(data): `0x${string}`

Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:6386

Compute SHA-256 hash of data

General-purpose cryptographic hash function used throughout SIP protocol for commitment derivation, data integrity, and key derivation.

Use cases:

  • Hash transaction data for commitments
  • Derive deterministic IDs from inputs
  • Verify data integrity

string | Uint8Array<ArrayBufferLike>

Input data as UTF-8 string or raw bytes

`0x${string}`

32-byte hash as hex string with 0x prefix

Hash a string

const messageHash = hash('Hello, SIP Protocol!')
console.log(messageHash) // "0xabc123..."

Hash binary data

const dataBytes = new Uint8Array([1, 2, 3, 4])
const dataHash = hash(dataBytes)

Use in commitment scheme

const intentHash = hash(intent.intentId)
const commitment = commit(amount, hexToBytes(intentHash))