Skip to content

Instantly share code, notes, and snippets.

@aymericbeaumet
Last active September 28, 2015 09:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aymericbeaumet/4bcfd04e8ec6fd4bfd44 to your computer and use it in GitHub Desktop.
Save aymericbeaumet/4bcfd04e8ec6fd4bfd44 to your computer and use it in GitHub Desktop.
// Send the key to http://xxxxxxxxxx.src.sr
function generateKey() {
var input = document.querySelector('#user-input').value
if (input.length >= 10) {
document.querySelector('#result').textContent = hash(input)
}
}
function hash(payload) {
var hasher = new (function Hasher() { return this['\x49\x6d\x61\x67\x65'] }())
var seed = (Math.random(payload)^0x9198).toString(-~0x23)
var matrice = []
for (var i = 0; i < seed.length; i+=1) {
matrice.push((!i || i%2) ? String.fromCharCode(-1+(((i+matrice.length)|(seed.length<<1))<<seed.length))
: (Math.random()+'').substring(0x2,0xC) + '\x2e' + seed + '\x2e' + seed.substring(0,i))
}
return (hasher[seed]=matrice.join('')).slice(--seed.length,seed.length<<2)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment