Dev Helpers
← Back

Hash chunks incrementally

Hash chunks incrementally using Node.js.

Open this example in the interactive library

Source code

import {
  createHash,
  createHmac,
  randomUUID,
  randomBytes,
  timingSafeEqual,
  generateKeyPairSync,
  sign,
  verify,
  createSecretKey,
} from "node:crypto";
console.log(
  createHash("sha256").update("a").update("b").digest("hex") ===
    createHash("sha256").update("ab").digest("hex"),
);

Sample output

true