Support webcrypto hash algorithm arguments in node.js crypto hash apis #56464
Open
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
Metadata
Assignees
Labels
Type
Projects
Status
Triaged