Skip to content

Instantly share code, notes, and snippets.

View Hammster's full-sized avatar
° ☆ ☾ ¸. Magical . •¸ ○ ° ★

Hans Koch Hammster

° ☆ ☾ ¸. Magical . •¸ ○ ° ★
View GitHub Profile
@Hammster
Hammster / crypto-pbkdf2-example.js
Last active September 2, 2020 12:48 — forked from skeggse/crypto-pbkdf2-example.js
Updated Example of using crypto.pbkdf2 to hash and verify passwords asynchronously, while storing the hash and salt in a single combined buffer along with the original hash settings
const crypto = require('crypto')
// larger numbers mean better security, less
const config = {
// size of the generated hash
hashBytes: 32,
// larger salt means hashed passwords are more resistant to rainbow table, but
// you get diminishing returns pretty fast
saltBytes: 16,
// A selected HMAC digest algorithm specified by digest is applied to derive