Open this example in the interactive library
Source code
import {
createHash,
createHmac,
randomUUID,
randomBytes,
timingSafeEqual,
generateKeyPairSync,
sign,
verify,
createSecretKey,
} from "node:crypto";
console.log(
createHmac("sha256", "demo-key").update("message").digest("base64"),
);
Sample output
SskAFTANO0Yz7wMHgfhYKuesgY03PFwR4Pzrzya8tMU=
