Skip to content

crypto.hmacSha256: add hmac-sha256 signing primitive#102

Merged
cs01 merged 2 commits intomainfrom
feature/crypto-hmac
Mar 6, 2026
Merged

crypto.hmacSha256: add hmac-sha256 signing primitive#102
cs01 merged 2 commits intomainfrom
feature/crypto-hmac

Conversation

@cs01
Copy link
Copy Markdown
Owner

@cs01 cs01 commented Mar 6, 2026

Summary

  • Add crypto.hmacSha256(key, data) — computes HMAC-SHA256 of data using key, returns a 64-character lowercase hex string. Uses OpenSSL's single-shot HMAC() function (already linked via -lcrypto). Covers the most common use cases: webhook signature verification and JWT signing.

Test plan

  • npm test passes (279/279, including new hmac sha256 fixture)
  • Verified against known test vector: key="key", data="The quick brown fox jumps over the lazy dog"f7bc83f430538424b13298e6aa6fb143ef4d59a14946175997479dbc2d1a3cd8
  • npm run verify:quick self-hosting passes

@cs01 cs01 merged commit 883514d into main Mar 6, 2026
12 checks passed
@cs01 cs01 deleted the feature/crypto-hmac branch March 6, 2026 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant