Files
Shade/packages/shade-key-transparency/src/sha256.ts

13 lines
435 B
TypeScript
Raw Normal View History

import { sha256 } from '@noble/hashes/sha2.js';
/**
* Synchronous SHA-256 — required because every Merkle hash composes
* many leaf/node hashes and an async API would force callers into
* promise chains for hot paths. `@noble/hashes` is the same dependency
* used elsewhere in the workspace (see `@shade/files`,
* `@shade/observability`).
*/
export function sha256Sync(data: Uint8Array): Uint8Array {
return sha256(data);
}