Created
October 26, 2011 12:57
-
-
Save alexaivars/1316269 to your computer and use it in GitHub Desktop.
quick n dirty solv
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
function zeroFill( number, width ) | |
{ | |
width -= number.toString().length; | |
if ( width > 0 ) | |
{ | |
return new Array( width + (/\./.test( number ) ? 2 : 1) ).join( '0' ) + number; | |
} | |
return number; | |
} | |
function toValueString(str) { | |
var checkboxes = document.getElementById('checkboxes').getElementsByTagName('input'); | |
var ret = ""; | |
for ( var i=0; i < str.length; i ++) { | |
ret += ( str[i] == "1" )? checkboxes[i].value : 'aa'; | |
} | |
return ret; | |
} | |
function solve() { | |
var checkboxes = document.getElementById('checkboxes').getElementsByTagName('input'); | |
var answer; | |
for ( var i=0; i< Math.pow(2, checkboxes.length) ; i++) | |
{ | |
var pass = toValueString( zeroFill( i.toString(2), 15 ) ); | |
if( hex_md5(pass) == "05eba37714e48265bb8a289341128f22" ) { | |
answer = zeroFill( i.toString(2), checkboxes.length ) + "\n" + pass; | |
alert( answer) ; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment