Created
July 13, 2013 08:12
-
-
Save wereHamster/5989944 to your computer and use it in GitHub Desktop.
Generate a random password from as many keys as there are on a standard US layout keyboard.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
var chars = | |
[ 'abcdefghijklmnopqrstuvwxyz' | |
, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' | |
, '1234567890' | |
, '~!@#$%^&*()_a+' | |
, '`-=' | |
, '[]{}o\'O",./<>?' | |
].join(); | |
var secret = '' | |
, length = parseInt(process.argv[process.argv.length - 1]) || 30; | |
for (var i = 0; i < length; ++i) { | |
secret = secret + chars[Math.floor(Math.random() * chars.length)]; | |
} | |
console.log(secret); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment