cloudflare / workerd

The JavaScript / Wasm runtime that powers Cloudflare Workers
https://blog.cloudflare.com/workerd-open-source-workers-runtime/
Apache License 2.0
5.88k stars 259 forks source link

feature request: crypto.hash node.js API #1781

Open Cherry opened 4 months ago

Cherry commented 4 months ago

A new API has landed in Node.js that's extremely ergonomic for one-off quick hashes:

crypto.hash('sha256', 'some-string')

instead of:

crypto.createHash('sha256').update('some-string').digest('hex')

I find myself often reaching for the Node.js crypto API over web crypto since it's much more ergonomic, and it would be great to see this addition landed in workerd in the future.

Reference: https://github.com/nodejs/node/pull/51044

jasnell commented 4 months ago

I've already got it on my list for when I continue working on the node.js compat