Skip to content

Instantly share code, notes, and snippets.

@RedHatter
Last active August 13, 2016 17:10
Show Gist options
  • Save RedHatter/b432f746cb53cc3f7f91 to your computer and use it in GitHub Desktop.
Save RedHatter/b432f746cb53cc3f7f91 to your computer and use it in GitHub Desktop.
Greasemonkey script that generates and auto fills passwords using the website's domain as the seed. http://idioticdev.com/sprouted-passwords.html
// ==UserScript==
// @name Sprouted Passwords
// @namespace http://idioticdev.com
// @description Generate and autofill passwords using that website's domain as the seed.
// @include *
// @version 1.3
// @require http://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0/jquery.min.js
// @require http://cdnjs.cloudflare.com/ajax/libs/seedrandom/2.4.2/seedrandom.min.js
// @grant GM_registerMenuCommand
// ==/UserScript==
const length = 26
const salt = 'Your Salt'
const hostname = window.location.hostname.replace('www.', '')
function sprout (seed = hostname) {
let salted = seed + salt
let rand = new Math.seedrandom(salted)
let value = ''
for (let i = 0; i < length; i++) {
value += String.fromCharCode(rand() * 94 + 33)
}
return value
}
$("input[type='password']").val(sprout())
GM_registerMenuCommand("Show password", () => prompt(hostname, sprout()))
GM_registerMenuCommand("From seed ...", () => {
let seed = prompt("What seed?", hostname)
prompt (seed, sprout(seed))
})
GM_registerMenuCommand("Fill from seed ...", () => {
let seed = prompt("What seed?", hostname)
$("input[type='password']").val(sprout(seed))
})
@tomatrow
Copy link

tomatrow commented Sep 9, 2015

I like the salt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment