SHA-224 (FIPS 180-4 §6.3) — thin wrapper over sha256 with a distinct IV + 7-word truncation.

Module sha224 | Source packages/front/fw/src/crypto/hash/sha224.js | Deps sha256 | Worker-safe yes

14-LOC wrapper over sha256._internal.makeSha(_INIT_224, 7). Previously this module duplicated ~80 LOC of the compression function — refactored in the post-upgrade audit.

Resolve

const sha224 = runtime.resolve('sha224');
// Returns: { fn, hash } (same shape as sha256, digest 7 words = 224 bits)

API

Method Signature Returns
hash (data: string | bitArray) => bitArray Digest 7 words × 32 bits = 224 bits
fn constructor() Streaming instance compatible with HMAC

Examples

const { sha224, hex, bitArray } = fw.runtime.resolveAll(['sha224', 'hex', 'bitArray']);

const digestBa = sha224.hash('abc');
hex.fromBytes(bitArray.ba_to_ui8(digestBa));
// "23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7"

Worker Usage

const worker = fw.createWorker(
    function ({ libs, args }) { self.postMessage(libs.sha224.hash(args[0])); },
    { dependencies: ['sha224'], args: ['abc'] }
);

Notes

  • HMAC-compatible: blockSize = 512 bits (identical to SHA-256, required by RFC 2104).
  • LDT 1 GiB validation gated behind CRYPTO_FULL=1 — see Conformance.
  • No own API: everything is delegated to sha256._internal.makeSha.

See also