Skip to content

Conversation

@FrederikBolding
Copy link
Member

@FrederikBolding FrederikBolding commented Dec 17, 2025

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.

Copy link
Member

@Mrtenz Mrtenz left a comment

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

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 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.

3 participants