Skip to content

Instantly share code, notes, and snippets.

@SkAZi
Created February 14, 2013 17:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SkAZi/4954257 to your computer and use it in GitHub Desktop.
Save SkAZi/4954257 to your computer and use it in GitHub Desktop.
function hackcrypt(last, message) {
var len = message.length;
for(var ret = "", i = 0; i < len; i++)
ret += chars[last = (i + last + message.charCodeAt(i)) % 64];
return ret;
}
function uncrypt(endata){
var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),
total = 0;
for(var ll=59; ll; ll--){
var ret = "", last = ll;
for(var i=0,l=endata.length; i < l ; i++){
var next_symb = 0;
while( endata.substr(0, i+1) !=
hackcrypt(ll, ret + chars[next_symb]).substr(0, i+1) &&
next_symb < 64){
next_symb++;
}
total += next_symb;
if(next_symb == 64) break;
ret += chars[next_symb];
}
if(encrypt(ret) == endata){
console.log('Hash count: ', total, 'Password: ', ret);
break;
}
}
}
uncrypt('mWodQ3pVKgLE');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment