1function e2eeForm(form) { 2 //var KEY = sha256($('input[name="g-recaptcha-response"]').val().substr(0,16)); 3 var KEY = sha256($('[name="g-recaptcha-response"]').val().substr(0,16)); 4 KEY = KEY.substr(0,16); 5 var IV = sha256(KEY); 6 IV = IV.substr(0,16); 7 8 var jsonData = {}; 9 jsonData['loginid'] = $('input[name="loginid"]').val(); 10 jsonData['loginpw'] = $('input[name="loginpw"]').val(); 11 12 var data = JSON.stringify(jsonData); 13 var key = CryptoJS.enc.Utf8.parse(KEY); 14 var iv = CryptoJS.enc.Utf8.parse(IV); 15 16 var result = CryptoJS.AES.encrypt(data, 17 key,{ 18 iv:iv 19 ,mode:CryptoJS.mode.CBC 20 ,padding:CryptoJS.pad.Pkcs7 21 }); 22 // var enString = result.ciphertext; 23 var enString = result.toString() 24 25 $('<input/>', { 26 type : 'hidden', 27 name : 'EnString', 28 value : enString 29 }).appendTo(form); 30 31 $('input[name="loginid"]').remove(); 32 $('input[name="loginpw"]').remove(); 33} 34 35var sha256 = function sha256(ascii) { 36 function rightRotate(value, amount) { 37 return (value>>>amount) | (value<<(32 - amount)); 38 }; 39 40 var mathPow = Math.pow; 41 var maxWord = mathPow(2, 32); 42 var lengthProperty = 'length' 43 var i, j; // Used as a counter across the whole file 44 var result = '' 45 46 var words = []; 47 var asciiBitLength = ascii[lengthProperty]*8; 48 49 //* caching results is optional - remove/add slash from front of this line to toggle 50 // Initial hash value: first 32 bits of the fractional parts of the square roots of the first 8 primes 51 // (we actually calculate the first 64, but extra values are just ignored) 52 var hash = sha256.h = sha256.h || []; 53 // Round constants: first 32 bits of the fractional parts of the cube roots of the first 64 primes 54 var k = sha256.k = sha256.k || []; 55 var primeCounter = k[lengthProperty]; 56 /*/ 57 var hash = [], k = []; 58 var primeCounter = 0; 59 //*/ 60 61 var isComposite = {}; 62 for (var candidate = 2; primeCounter < 64; candidate++) { 63 if (!isComposite[candidate]) { 64 for (i = 0; i < 313; i += candidate) { 65 isComposite[i] = candidate; 66 } 67 hash[primeCounter] = (mathPow(candidate, .5)*maxWord)|0; 68 k[primeCounter++] = (mathPow(candidate, 1/3)*maxWord)|0; 69 } 70 } 71 72 ascii += '\x80' // Append Æ' bit (plus zero padding) 73 while (ascii[lengthProperty]%64 - 56) ascii += '\x00' // More zero padding 74 for (i = 0; i < ascii[lengthProperty]; i++) { 75 j = ascii.charCodeAt(i); 76 if (j>>8) return; // ASCII check: only accept characters in range 0-255 77 words[i>>2] |= j << ((3 - i)%4)*8; 78 } 79 words[words[lengthProperty]] = ((asciiBitLength/maxWord)|0); 80 words[words[lengthProperty]] = (asciiBitLength) 81 82 // process each chunk 83 for (j = 0; j < words[lengthProperty];) { 84 var w = words.slice(j, j += 16); // The message is expanded into 64 words as part of the iteration 85 var oldHash = hash; 86 // This is now the undefinedworking hash", often labelled as variables a...g 87 // (we have to truncate as well, otherwise extra entries at the end accumulate 88 hash = hash.slice(0, 8); 89 90 for (i = 0; i < 64; i++) { 91 var i2 = i + j; 92 // Expand the message into 64 words 93 // Used below if 94 var w15 = w[i - 15], w2 = w[i - 2]; 95 96 // Iterate 97 var a = hash[0], e = hash[4]; 98 var temp1 = hash[7] 99 + (rightRotate(e, 6) ^ rightRotate(e, 11) ^ rightRotate(e, 25)) // S1 100 + ((e&hash[5])^((~e)&hash[6])) // ch 101 + k[i] 102 // Expand the message schedule if needed 103 + (w[i] = (i < 16) ? w[i] : ( 104 w[i - 16] 105 + (rightRotate(w15, 7) ^ rightRotate(w15, 18) ^ (w15>>>3)) // s0 106 + w[i - 7] 107 + (rightRotate(w2, 17) ^ rightRotate(w2, 19) ^ (w2>>>10)) // s1 108 )|0 109 ); 110 // This is only used once, so *could* be moved below, but it only saves 4 bytes and makes things unreadble 111 var temp2 = (rightRotate(a, 2) ^ rightRotate(a, 13) ^ rightRotate(a, 22)) // S0 112 + ((a&hash[1])^(a&hash[2])^(hash[1]&hash[2])); // maj 113 114 hash = [(temp1 + temp2)|0].concat(hash); // We don't bother trimming off the extra ones, they're harmless as long as we're truncating when we do the slice() 115 hash[4] = (hash[4] + temp1)|0; 116 } 117 118 for (i = 0; i < 8; i++) { 119 hash[i] = (hash[i] + oldHash[i])|0; 120 } 121 } 122 123 for (i = 0; i < 8; i++) { 124 for (j = 3; j + 1; j--) { 125 var b = (hash[i]>>(j*8))&255; 126 result += ((b < 16) ? 0 : '') + b.toString(16); 127 } 128 } 129 return result; 130}; 131 132$(document).ready(function(){ 133 134});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.