Skip to content
This repository was archived by the owner on Sep 11, 2026. It is now read-only.

feat: Add SHA-256 utility - #273

Merged
FrederikBolding merged 8 commits into
mainfrom
fb/sha-256
Dec 17, 2025
Merged

FrederikBolding merged 8 commits into
mainfrom
fb/sha-256

Conversation

@FrederikBolding

@FrederikBolding FrederikBolding commented Dec 17, 2025 •

Copy link
Copy Markdown
Member

We have a bunch of SHA-256 utilities scattered in different repos, this attempts to upstream a stable one that uses the faster native option when possible.


Note

Adds a sha256 utility that prefers Web Crypto and falls back to @noble/hashes, with tests and public export.

  • Utilities
    • Add sha256(bytes: Uint8Array) in src/hashing.ts using globalThis.crypto.subtle.digest('SHA-256') when available, falling back to @noble/hashes/sha256.
  • Tests
    • New src/hashing.test.ts verifying digests, fallback behavior when crypto.subtle/digest are unavailable, and Node 18 webcrypto setup.
  • Exports
    • Re-export sha256 from src/index.ts; update snapshots in src/index.test.ts and src/node.test.ts to include "sha256".

Written by Cursor Bugbot for commit 8961a54. This will update automatically on new commits. Configure here.

@Mrtenz Mrtenz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing export in index.ts

Comment thread src/hashing.test.ts Outdated
Comment thread src/hashing.ts
Comment thread src/hashing.ts Outdated
Comment thread src/hashing.ts Outdated
Co-authored-by: Maarten Zuidhoorn <maarten@zuidhoorn.com>
Mrtenz
Mrtenz previously approved these changes Dec 17, 2025
@FrederikBolding
FrederikBolding enabled auto-merge (squash) December 17, 2025 12:40
@FrederikBolding
FrederikBolding merged commit be13e2b into main Dec 17, 2025
22 checks passed
@FrederikBolding
FrederikBolding deleted the fb/sha-256 branch December 17, 2025 12:41
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants