SHA-384 (FIPS 180-4 §6.5) — thin wrapper over sha512 with a distinct IV + 12-word truncation.
Module sha384 | Source packages/front/fw/src/crypto/hash/sha384.js | Deps sha512 | Worker-safe yes
14-LOC wrapper over sha512._internal.makeSha(_INIT_384, 12). Previously this module duplicated ~120 LOC of the compression function — refactored in the post-upgrade audit.
Resolve
const sha384 = runtime.resolve('sha384');
// Returns: { fn, hash } (digest 12 words = 384 bits)
API
| Method | Signature | Returns |
|---|---|---|
hash |
(data: string | bitArray) => bitArray |
Digest 12 words × 32 bits = 384 bits |
fn |
constructor() |
Streaming instance compatible with HMAC (blockSize 1024) |
Examples
const { sha384, hex, bitArray } = fw.runtime.resolveAll(['sha384', 'hex', 'bitArray']);
hex.fromBytes(bitArray.ba_to_ui8(sha384.hash('abc')));
// "cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7"
Worker Usage
const worker = fw.createWorker(
function ({ libs, args }) { self.postMessage(libs.sha384.hash(args[0])); },
{ dependencies: ['sha384'], args: ['abc'] }
);
Notes
- Block size: 1024 bits (identical to SHA-512, required by HMAC-SHA-384).
- LDT 1 GiB gated behind
CRYPTO_FULL=1.