Last active
September 28, 2015 09:38
-
-
Save aymericbeaumet/4bcfd04e8ec6fd4bfd44 to your computer and use it in GitHub Desktop.
Submission for: http://misdirect.ion.land. Try it: http://jsfiddle.net/99ebjsqo/5. Read more about it: http://javahacker.com/the-first-javascript-misdirection-contest
This file contains hidden or 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
// 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