-
-
Notifications
You must be signed in to change notification settings - Fork 35.3k
Support webcrypto hash algorithm arguments in node.js crypto hash apis #56464
Copy link
Copy link
Closed as not planned
Closed as not planned
Copy link
Labels
cryptoIssues and PRs related to the crypto subsystem.Issues and PRs related to the crypto subsystem.feature requestIssues that request new features to be added to Node.js.Issues that request new features to be added to Node.js.stalewebcrypto
Description
What is the problem this feature will solve?
In Node.js, we would do crypto.createHash('sha256') ... in web crypto we can do either crypto.subtle.digest('sha256', ...) or crypto.subtle.digest({ name: 'sha256' }, ...) (string or object). For consistency, it would be helpful to be able to support the webcrypto style arguments in the Node.js APIs also..
What is the feature you are proposing to solve the problem?
const { createHash } = require('node:crypto');
const algorithm = { name: 'sha256' };
// Support the same argument types in createHash/createHmac that are supported in web crypto..
const hash = createHash(algorithm);
// ...What alternatives have you considered?
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
cryptoIssues and PRs related to the crypto subsystem.Issues and PRs related to the crypto subsystem.feature requestIssues that request new features to be added to Node.js.Issues that request new features to be added to Node.js.stalewebcrypto
Type
Projects
Status
Triaged