Skip to content

crypto: support outputLength option in crypto.hash for XOF functions - #58121

Merged
nodejs-github-bot merged 1 commit into
nodejs:mainfrom
Aditi-1400:crypto-hash
Jul 8, 2025
Merged

crypto: support outputLength option in crypto.hash for XOF functions#58121
nodejs-github-bot merged 1 commit into
nodejs:mainfrom
Aditi-1400:crypto-hash

Conversation

@Aditi-1400

Copy link
Copy Markdown
Contributor

Support outputLength option in crypto.hash() for XOF hash functions to align with the behaviour of crypto.createHash() API

Fixes: #57312

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/crypto
  • @nodejs/security-wg

@nodejs-github-botnodejs-github-bot added lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. labels May 2, 2025
@panva
panva requested review from joyeecheung and tniessenMay 2, 2025 14:26
@panvapanva added the crypto Issues and PRs related to the crypto subsystem. label May 2, 2025
Comment threaddeps/ncrypto/ncrypto.cc

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

@Aditi-1400 please change the PR title and commit message to crypto: support outputLength in crypto.hash for XOF functions

@Aditi-1400Aditi-1400 changed the title src: support outputLength in XOF hash functionscrypto: support outputLength in XOF hash functionsMay 2, 2025
@codecov

codecovBot commented May 2, 2025

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 82.85714% with 12 lines in your changes missing coverage. Please review.

Project coverage is 90.08%. Comparing base (f5da8f8) to head (a27fe2b).
Report is 68 commits behind head on main.

Files with missing linesPatch %Lines
src/crypto/crypto_hash.cc73.33%9 Missing and 3 partials ⚠️
Additional details and impacted files
@@ Coverage Diff @@## main #58121 +/- ##
==========================================
- Coverage 90.08% 90.08% -0.01% 
==========================================
Files 640 640 Lines 188517 188569 +52 Branches 36975 36995 +20 ==========================================
+ Hits 169826 169868 +42 - Misses 11402 11418 +16 + Partials 7289 7283 -6 
Files with missing linesCoverage Δ
lib/internal/crypto/hash.js98.53% <100.00%> (+0.09%)⬆️
src/crypto/crypto_hash.cc70.35% <73.33%> (-0.21%)⬇️

... and 29 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

DataPointer xofHashDigest(const Buffer<const unsigned char>& buf,
const EVP_MD* md,
size_t output_length) {
if (md == nullptr) return {};

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.

@codebytere ... can I ask you to take a look at this from a Whether-This-Will-Work-In-BoringSSL perspective?

Comment threaddeps/ncrypto/ncrypto.cc Outdated
Comment threaddeps/ncrypto/ncrypto.h
Comment threaddoc/api/crypto.md Outdated
Comment threadsrc/crypto/crypto_hash.cc Outdated
Comment threaddoc/api/crypto.md Outdated
Comment threaddeps/ncrypto/ncrypto.cc Outdated
panva added a commit to panva/node that referenced this pull request Jul 3, 2025
@Aditi-1400
Aditi-1400force-pushed the crypto-hash branch 3 times, most recently from beb4f68 to 068c2ceCompareJuly 3, 2025 17:26
@joyeecheungjoyeecheung added the request-ci Add this label to start a Jenkins CI on a PR. label Jul 8, 2025
@joyeecheung

Copy link
Copy Markdown
Member

Needs a new CI after the push

@panvapanva removed the request-ci Add this label to start a Jenkins CI on a PR. label Jul 8, 2025
@panva

panva commented Jul 8, 2025

Copy link
Copy Markdown
Member

@joyeecheung CI has ran with the latest push.

@panvapanva added the commit-queue Add this label to land a pull request using GitHub Actions. label Jul 8, 2025
@nodejs-github-botnodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Jul 8, 2025
@nodejs-github-bot
nodejs-github-bot merged commit 1c4fe6d into nodejs:mainJul 8, 2025
68 checks passed
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Landed in 1c4fe6d

RafaelGSS pushed a commit that referenced this pull request Jul 8, 2025
Reverts: #56160Fixes: #56159Fixes: #58913
Refs: #58121
PR-URL: #58942
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
RafaelGSS pushed a commit that referenced this pull request Jul 8, 2025
Support `outputLength` option in crypto.hash() for XOF hash
functions to align with the behaviour of crypto.createHash()
API
closes: #57312
Co-authored-by: Filip Skokan <panva.ip@gmail.com>
PR-URL: #58121Fixes: #57312
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
nodejs-github-bot added a commit that referenced this pull request Jul 8, 2025
Notable changes:
crypto:
* (SEMVER-MINOR) support outputLength option in crypto.hash for XOF functions (Aditi) #58121
doc:
* (SEMVER-MINOR) add all watch-mode related flags to node.1 (Dario Piotrowicz) #58719
fs:
* (SEMVER-MINOR) add disposable mkdtempSync (Kevin Gibbons) #58516
permission:
* (SEMVER-MINOR) propagate permission model flags on spawn (Rafael Gonzaga) #58853
sqlite:
* (SEMVER-MINOR) add support for readBigInts option in db connection level (Miguel Marcondes Filho) #58697
src,permission:
* (SEMVER-MINOR) add support to permission.has(addon) (Rafael Gonzaga) #58951
watch:
* (SEMVER-MINOR) add `--watch-kill-signal` flag (Dario Piotrowicz) #58719
PR-URL: #58993
RafaelGSS pushed a commit that referenced this pull request Jul 9, 2025
Notable changes:
crypto:
* (SEMVER-MINOR) support outputLength option in crypto.hash for XOF functions (Aditi) #58121
doc:
* (SEMVER-MINOR) add all watch-mode related flags to node.1 (Dario Piotrowicz) #58719
fs:
* (SEMVER-MINOR) add disposable mkdtempSync (Kevin Gibbons) #58516
permission:
* (SEMVER-MINOR) propagate permission model flags on spawn (Rafael Gonzaga) #58853
sqlite:
* (SEMVER-MINOR) add support for readBigInts option in db connection level (Miguel Marcondes Filho) #58697
src,permission:
* (SEMVER-MINOR) add support to permission.has(addon) (Rafael Gonzaga) #58951
watch:
* (SEMVER-MINOR) add `--watch-kill-signal` flag (Dario Piotrowicz) #58719
PR-URL: #58993
aduh95 pushed a commit to panva/node that referenced this pull request Jul 21, 2025
Reverts: nodejs#56160Fixes: nodejs#56159Fixes: nodejs#58913
Refs: nodejs#58121
PR-URL: nodejs#58942
Backport-PR-URL: nodejs#58960
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
@aduh95aduh95 added the backport-requested-v22.x PRs awaiting manual backport to the v22.x-staging branch. label Jul 21, 2025
@aduh95

Copy link
Copy Markdown
Contributor

This doesn't land cleanly on v22.x-staging

marco-ippolito pushed a commit that referenced this pull request Aug 14, 2025
Reverts: #56160Fixes: #56159Fixes: #58913
Refs: #58121
PR-URL: #58942
Backport-PR-URL: #58961
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
marco-ippolito pushed a commit that referenced this pull request Aug 25, 2025
Reverts: #56160Fixes: #56159Fixes: #58913
Refs: #58121
PR-URL: #58942
Backport-PR-URL: #58961
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
marco-ippolito pushed a commit that referenced this pull request Aug 27, 2025
Reverts: #56160Fixes: #56159Fixes: #58913
Refs: #58121
PR-URL: #58942
Backport-PR-URL: #58961
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
marco-ippolito pushed a commit that referenced this pull request Aug 27, 2025
Reverts: #56160Fixes: #56159Fixes: #58913
Refs: #58121
PR-URL: #58942
Backport-PR-URL: #58961
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
npaun pushed a commit to npaun/ncrypto that referenced this pull request Sep 18, 2025
Support `outputLength` option in crypto.hash() for XOF hash
functions to align with the behaviour of crypto.createHash()
API
closes: nodejs/node#57312
Co-authored-by: Filip Skokan <panva.ip@gmail.com>
PR-URL: nodejs/node#58121Fixes: nodejs/node#57312
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
npaun pushed a commit to npaun/ncrypto that referenced this pull request Sep 18, 2025
Support `outputLength` option in crypto.hash() for XOF hash
functions to align with the behaviour of crypto.createHash()
API
closes: nodejs/node#57312
Co-authored-by: Filip Skokan <panva.ip@gmail.com>
PR-URL: nodejs/node#58121Fixes: nodejs/node#57312
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
@Aditi-1400

Copy link
Copy Markdown
ContributorAuthor

This pull request at least depends on #56653, #57300 and #54028

npaun pushed a commit to npaun/ncrypto that referenced this pull request Sep 25, 2025
Support `outputLength` option in crypto.hash() for XOF hash
functions to align with the behaviour of crypto.createHash()
API
closes: nodejs/node#57312
Co-authored-by: Filip Skokan <panva.ip@gmail.com>
PR-URL: nodejs/node#58121Fixes: nodejs/node#57312
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
npaun pushed a commit to npaun/ncrypto that referenced this pull request Sep 25, 2025
Support `outputLength` option in crypto.hash() for XOF hash
functions to align with the behaviour of crypto.createHash()
API
closes: nodejs/node#57312
Co-authored-by: Filip Skokan <panva.ip@gmail.com>
PR-URL: nodejs/node#58121Fixes: nodejs/node#57312
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
npaun pushed a commit to npaun/ncrypto that referenced this pull request Sep 25, 2025
Support `outputLength` option in crypto.hash() for XOF hash
functions to align with the behaviour of crypto.createHash()
API
closes: nodejs/node#57312
Co-authored-by: Filip Skokan <panva.ip@gmail.com>
PR-URL: nodejs/node#58121Fixes: nodejs/node#57312
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
npaun pushed a commit to npaun/ncrypto that referenced this pull request Sep 26, 2025
Support `outputLength` option in crypto.hash() for XOF hash
functions to align with the behaviour of crypto.createHash()
API
closes: nodejs/node#57312
Co-authored-by: Filip Skokan <panva.ip@gmail.com>
PR-URL: nodejs/node#58121Fixes: nodejs/node#57312
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
anonrig pushed a commit to nodejs/ncrypto that referenced this pull request Sep 26, 2025
Support `outputLength` option in crypto.hash() for XOF hash
functions to align with the behaviour of crypto.createHash()
API
closes: nodejs/node#57312
Co-authored-by: Filip Skokan <panva.ip@gmail.com>
PR-URL: nodejs/node#58121Fixes: nodejs/node#57312
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-requested-v22.xPRs awaiting manual backport to the v22.x-staging branch.commit-queue-squashAdd this label to instruct the Commit Queue to squash all the PR commits into the first one.cryptoIssues and PRs related to the crypto subsystem.lib / srcIssues and PRs related to general changes in the lib or src directory.needs-ciPRs that need a full CI run.review wantedPRs that need reviews.semver-minorPRs that contain new features and should be released in the next minor version.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

crypto.hash XOF hash functions outputLength option

7 participants

@Aditi-1400@nodejs-github-bot@panva@joyeecheung@aduh95@jasnell@RafaelGSS