Skip to content

Instantly share code, notes, and snippets.

View openarun's full-sized avatar
🤓

Arun Kumar Pariyar openarun

🤓
View GitHub Profile
@billyxs
billyxs / crypto-pbkdf2-auth-example.js
Last active October 11, 2020 16:50
CryptoJS PBKDF2 hashing with javascript. This could be used for a simple, not high security, password auth.
// bower install crypto-js
// Add to scripts to html file
// <script src="bower_components/crypto-js/crypto-js.js"></script>
// <script src="bower_components/crypto-js/pbkdf2.js"></script>
function auth(password) {
// Make a salt with CryptoJS.lib.WordArray.random(128/8);
var salt = 'your salt'; // CryptoJS.lib.WordArray.random(128/8);
// 1000 iterations takes a couple seconds in the browser. Wouldn't want to go much higher if this is a browser implementation