Skip to content

Instantly share code, notes, and snippets.

View mxbrandi's full-sized avatar

Max Brandi mxbrandi

View GitHub Profile
@mxbrandi
mxbrandi / gist:7f23faab72fb79f08c3cadbe8d2c3e46
Last active June 27, 2019 14:31
Find appropriate iteration count for bcryptjs
// According to the OWASP recommendation, the iteration count should be increased until the hash computation takes around 1 second.
// Other recommendations are between 250 and 500 ms.
// This procedure is performed, since the short delay is acceptable by the user but it thwarts password attacks (rainbow tables/brute force) effectively.
// Run this script on the target system and find the appropriate number of iterations by looking at the execution time.
// Requirements: `npm install bcryptjs`
const bcrypt = require('bcryptjs');