Decipher THIS, Mensa f*ckers. The answers are in the array q, ran by the hashing function. Courtesy of www.mensa-test.com/script2.js . Code: answer1 = "tralalala"; q = new Array(); q['q1'] = '0cff53a049c4a450c4ee1ac2dbc8857a65792b50'; q['q2'] = '843ad89d075446c735cbb44d5feec971f85ede52'; q['q3'] = 'c090f34887018652d035680f36b9a963ab3db2d7'; q['q4'] = '96334db4e00c0d70875f81827a9be5b1e951f32a'; q['q5'] = 'fe0d7715eb655562a06db9a2e600fc4297981e21'; q['q6'] = '0df8ff729d6bbd6b64ef27bc2f5af1a84309d181'; q['q7'] = '8ea1e56fd6f18a3301bf8b9ee1d78a3a5aaac039'; q['q8'] = '1070bf67cc99df4fc4651a9bc0df38ab8b69559b'; q['q9'] = 'f655993dc2478a0b19be5122ea97d32066591d72'; q['q10'] = '1423436061592b3246bcced6c3b4f70a9ba3cdaa'; q['q11'] = '5c38cb674163ebca2fecd57f362244e44b6dd28a'; q['q12'] = '3dd6cc30878a030cf8fdaea7a5844461f578cfbb'; q['q13'] = '74b24215285323e8d3dbf9dabe023ec15dc6fc72'; q['q14'] = '3259d200d2b420a653317f2c6f61cd97392d88ac'; q['q15'] = '2bd85b273d10f8b1e8b8252a3ca19c6cd89ce6e8'; q['q16'] = '71c6064558183aecf1ce2149384d16cc2dff291a'; q['q17'] = 'd5ee6be2106aacf5ae126c6f4681e636dae5e0d0'; q['q18'] = '60e7ee76bba171f8057403437e9f8f704008e8ff'; q['q19'] = 'f5d89d1e6697bf356045566a272f55fda6150455'; q['q20'] = '30b72655c3877e8954c846ba0ff9f0fa78078802'; q['q21'] = 'aaa1c03520bf3a2e4ff3e5f215a743791d4b50e9'; q['q22'] = '377031a8d2dba7664d968c21fcf0d1af64d4d52a'; q['q23'] = 'dc63c80395c67d15fea27ad2bc836ce3154b06e3'; q['q24'] = 'ad92bd98a9fdae3bb80284c0dc7a25f60f5648e7'; q['q25'] = '4f9355fa2fde56d906f87242300c8da9a4ac0426'; q['q26'] = 'e4d8702258e030378bb17b22eb1db6da14561e9d'; q['q27'] = '05efd89c2e060d0ac6f4b1823bcdfea754bc6a0e'; q['q28'] = 'cebf9b69f89e16474e364eac4c2fec5cfd2bb713'; q['q29'] = '5ff332470d3e7bcdca89f871c017570eecc99a79'; q['q30'] = '71be49b6ea312c7e7ca3e27059605cc37932775a'; q['q31'] = '71900b34f4277cbc7eb203409907822ffb75b327'; q['q32'] = '00b91cf6b453aa3d56607716d7aa3fbd2596486d'; q['q33'] = '5174b2c113880b1d008a21167e336a1046a64c82'; function checkQ(str) { if(sha1Hash(document.getElementById(str).value.toUpperCase()) == q[str]) { validate1(str); } else { validate2(str); } } function validate1(qstr) { if(document.getElementById(qstr).disabled == false) { document.getElementById(qstr).disabled = true; document.getElementById(qstr).style.border = '2px solid #00FF00'; document.getElementById('correct').innerHTML = document.getElementById('correct').innerHTML*1 + 1; } } function validate2(qstr) { if(document.getElementById(qstr).value=='') { document.getElementById(qstr).style.border = '1px solid #A5ACB2'; } else { document.getElementById(qstr).style.border = '2px solid #FF0000'; } } function sha1Hash(msg) { // constants [4.2.1] var K = [0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6]; // PREPROCESSING msg += String.fromCharCode(0x80); // add trailing '1' bit to string [5.1.1] // convert string msg into 512-bit/16-integer blocks arrays of ints [5.2.1] var l = Math.ceil(msg.length/4) + 2; // long enough to contain msg plus 2-word length var N = Math.ceil(l/16); // in N 16-int blocks var M = new Array(N); for (var i=0; i<N; i++) { M[i] = new Array(16); for (var j=0; j<16; j++) { // encode 4 chars per integer, big-endian encoding M[i][j] = (msg.charCodeAt(i*64+j*4)<<24) | (msg.charCodeAt(i*64+j*4+1)<<16) | (msg.charCodeAt(i*64+j*4+2)<<8) | (msg.charCodeAt(i*64+j*4+3)); } // note running off the end of msg is ok 'cos bitwise ops on NaN return 0 } // add length (in bits) into final pair of 32-bit integers (big-endian) [5.1.1] M[N-1][14] = ((msg.length-1) >>> 30) * 8; M[N-1][15] = ((msg.length-1)*8) & 0xffffffff; // set initial hash value [5.3.1] var H0 = 0x67452301; var H1 = 0xefcdab89; var H2 = 0x98badcfe; var H3 = 0x10325476; var H4 = 0xc3d2e1f0; // HASH COMPUTATION [6.1.2] var W = new Array(80); var a, b, c, d, e; for (var i=0; i<N; i++) { // 1 - prepare message schedule 'W' for (var t=0; t<16; t++) W[t] = M[i][t]; for (var t=16; t<80; t++) W[t] = ROTL(W[t-3] ^ W[t-8] ^ W[t-14] ^ W[t-16], 1); // 2 - initialise five working variables a, b, c, d, e with previous hash value a = H0; b = H1; c = H2; d = H3; e = H4; // 3 - main loop for (var t=0; t<80; t++) { var s = Math.floor(t/20); // seq for blocks of 'f' functions and 'K' constants var T = (ROTL(a,5) + f(s,b,c,d) + e + K[s] + W[t]) & 0xffffffff; e = d; d = c; c = ROTL(b, 30); b = a; a = T; } // 4 - compute the new intermediate hash value H0 = (H0+a) & 0xffffffff; // note 'addition modulo 2^32' H1 = (H1+b) & 0xffffffff; H2 = (H2+c) & 0xffffffff; H3 = (H3+d) & 0xffffffff; H4 = (H4+e) & 0xffffffff; } return H0.toHexStr() + H1.toHexStr() + H2.toHexStr() + H3.toHexStr() + H4.toHexStr(); } // // function 'f' [4.1.1] // function f(s, x, y, z) { switch (s) { case 0: return (x & y) ^ (~x & z); case 1: return x ^ y ^ z; case 2: return (x & y) ^ (x & z) ^ (y & z); case 3: return x ^ y ^ z; } } // // rotate left (circular left shift) value x by n positions [3.2.5] // function ROTL(x, n) { return (x<<n) | (x>>>(32-n)); } // // extend Number class with a tailored hex-string method // (note toString(16) is implementation-dependant, and // in IE returns signed numbers when used on full words) // Number.prototype.toHexStr = function() { var s="", v; for (var i=7; i>=0; i--) { v = (this>>>(i*4)) & 0xf; s += v.toString(16); } return s; } function resetForm() { for(i=1;i<34;i++) { document.getElementById('q'+i).disabled = false; } document.forms[0].reset(); }
Try deleting the entire line and typing it all over again, if you mispell once it will count it as wrong until you delete everything and type it again.
Nope. You can do a for loop without it in JavaScript. It's acceptable. Your argument would also cause line 84 to fail: Code: [84] for (var i=0; i<N; i++) { [85] M[i] = new Array(16); [86] for (var j=0; j<16; j++) { // encode 4 chars per integer, big-endian encoding
This doesn't seem so much a test of intelligence as a test of your trivia knowledge. But I'll give it a shot anyway.