Skip to content

Instantly share code, notes, and snippets.

View srajagop's full-sized avatar
🎯
Focusing

Santhana Sethubalan srajagop

🎯
Focusing
View GitHub Profile
@srajagop
srajagop / crypto-pbkdf2-example.js
Created May 15, 2018 18:57 — forked from skeggse/crypto-pbkdf2-example.js
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
var crypto = require('crypto');
// larger numbers mean better security, less
var 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,
// more iterations means an attacker has to take longer to brute force an