Skip to content

Instantly share code, notes, and snippets.

@ctrezevant ctrezevant/pass.js
Last active Apr 21, 2019

Embed
What would you like to do?
Absurdly ridiculous quick n dirty random password sheet generator
// Absurdly ridiculous random password sheet generator
// For use at https://www.rempe.us/diceware/#eff
function genPass(numWords) {
var randChars = "@%^*().?:;+=-_";
var gen = getWords(numWords, 5);
var passwd = [];
for (var i = gen.length - 1; i != -1; i--) {
var goodness = "";
for (var j = 0; j < (Math.floor(Math.random() * 6) + 1); j++) {
if (j == 0 || (Math.random() / Math.random()) > (Math.random() / Math.random()))
goodness += randChars.charAt(Math.floor(Math.random() * randChars.length));
}
if ((Math.random() / Math.random()) <= (Math.random() / Math.random()))
gen[i].word = gen[i].word.charAt(0).toUpperCase() + gen[i].word.slice(1, gen[i].word.length)
passwd.push(gen[i].word + goodness);
}
return passwd.join("");
}
var people = ["Peter", "Peyton", "Charlton", "Martin", "Michael R", "Matt", "Alex", "Michael I"];
var counter = 1;
for (var i = 0; i < people.length; i++) {
console.log("---- " + people[i]);
for (var j = 0; j < 25; j++) {
console.log("[" + counter + "] " + genPass(2));
counter++;
}
console.log("----");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.