hash()
SIP Protocol API Reference v0.7.0
SIP Protocol API Reference / hash
Function: hash()
Section titled “Function: hash()”hash(
data):`0x${string}`
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:3372
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
Parameters
Section titled “Parameters”Input data as UTF-8 string or raw bytes
string | Uint8Array<ArrayBufferLike>
Returns
Section titled “Returns”`0x${string}`
32-byte hash as hex string with 0x prefix
Examples
Section titled “Examples”const messageHash = hash('Hello, SIP Protocol!')console.log(messageHash) // "0xabc123..."const dataBytes = new Uint8Array([1, 2, 3, 4])const dataHash = hash(dataBytes)const intentHash = hash(intent.intentId)const commitment = commit(amount, hexToBytes(intentHash))