Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide Hash utilities: Deno.hash / Deno.password #28277

Open
Tracked by #28200
CyanChanges opened this issue Feb 24, 2025 · 0 comments
Open
Tracked by #28200

Provide Hash utilities: Deno.hash / Deno.password #28277

CyanChanges opened this issue Feb 24, 2025 · 0 comments

Comments

@CyanChanges
Copy link
Contributor

Part of #28200

Deno.hash / Deno.password

In Node.js, we do hash like:

import { createHash } from 'node:crypto'

const hash = createHash('sha256')
  .update("pa$$word")
  .digest('hex')

node:crypto only have support for algorithm supported in openssl.
But in nowadays, we may use more likely to use argon2, yescrypt for hashing passwords,
but those isn't in node:crypto, if we can just

const hash = await Deno.password.hash("pa$$word", {
 algorithm: "argon2id",
 memory: 2,
 time: 2
})

and

const hash = await Deno.hash.sha256("whatever")

it will be more easier to use, and
implementation in native will also be faster.
(or maybe use wasm to avoid v8 internal binding costs)

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

No branches or pull requests

1 participant