@tevm/voltaire / index / wasm / Sha256Wasm
Sha256Wasm
SHA256 hash function implemented using WASM Zig codeVariables
BLOCK_SIZE
Defined in: src/crypto/sha256.wasm.ts:20 SHA256 block size in bytesconstBLOCK_SIZE:64=64
OUTPUT_SIZE
Defined in: src/crypto/sha256.wasm.ts:15 SHA256 output size in bytes (256 bits / 8)constOUTPUT_SIZE:32=32
Functions
create()
create(): object
Defined in: src/crypto/sha256.wasm.ts:110
Incremental hasher for streaming data
Note: This implementation uses a simple buffer accumulator.
For truly large streaming data, consider using the Noble.js implementation.
Returns
digest()
digest(): Uint8Array
Finalize and get hash
Returns
Uint8Array
update()
update(Update hasher with new datadata):void
Parameters
data
Uint8Array
Returns
void
Example
hash()
hash(Defined in: src/crypto/sha256.wasm.ts:34 Compute SHA256 hash of input datadata):Uint8Array
Parameters
data
Uint8Array
Input data as Uint8Array
Returns
Uint8Array
32-byte hash
Example
hashHex()
hashHex(Defined in: src/crypto/sha256.wasm.ts:68 Compute SHA256 hash of hex string (without 0x prefix)hex):Uint8Array
Parameters
hex
string
Hex string (with or without 0x prefix)
Returns
Uint8Array
32-byte hash
Example
hashString()
hashString(Defined in: src/crypto/sha256.wasm.ts:50 Compute SHA256 hash of UTF-8 stringstr):Uint8Array
Parameters
str
string
Input string
Returns
Uint8Array
32-byte hash
Example
toHex()
toHex(Defined in: src/crypto/sha256.wasm.ts:90 Convert hash output to hex stringhash):string
Parameters
hash
Uint8Array
Hash bytes
Returns
string
Hex string with 0x prefix

