Javascript 스 크 립 트 정적 웹 페이지 암호 화 인 스 턴 스 코드 구현

27111 단어
Javascript 스 크 립 트 는 정적 웹 암호 화 를 실현 합 니 다. Javascript 스 크 립 트 를 읽 고 정적 웹 암호 화 를 실현 합 니 다. 이틀 전에 누군가가 정적 웹 암호 화 문 제 를 묻 는 것 을 보고 이 코드 방향 을 썼 습 니 다. 암호 화 할 때 사용자 의 키 A 를 md5 로 B 로 암호 화 한 다음 에 B 이상 또는 원본 파일 S10 으로 대상 파일 S1 을 얻 고 S1 을 js 변수 에 저장 합 니 다.복호화 시: 키 를 묻 고 암호 화 작업 을 합 니 다.
이틀 전에 어떤 사람 이 정적 웹 페이지 암호 화 문 제 를 묻 는 것 을 보고 이 코드 를 썼 다.
생각:
암호 화 할 때: 먼저 사용자 의 키 A 를 md5 로 B 로 암호 화 한 다음 에 B 이상 또는 원본 파일 S10 으로 대상 파일 S1 을 얻 고 S1 을 js 변수 에 저장 합 니 다.
복호화 시: 키 를 물 어보 고 암호 화 를 조작 합 니 다.
md5 를 사 용 했 기 때문에 개인 적 으로 키 가 없 을 때 풀 수 없다 고 생각 합 니 다 (폭력 제외)
여러분 한번 써 보 세 요 하하:
원본 코드 는 다음 과 같 습 니 다:
 
  


Web Encoder

<br>function webEncode(){<br> strSource=escape(XOR(t1.value,STR.md5(p1.value)));<br> //strSource=t1.value;<br> strOut="<script>\r
strHTML=\"\";\r
";<br> for(var i=0;i+70<strSource.length;i+=70){<br>  strOut+="strHTML+=\""+addSlash(strSource.substring(i,i+70))+"\";\r
";<br> }<br> strOut+="strHTML+=\""+addSlash(strSource.substring(i,strSource.length))+"\";\r
";<br> strOut+=XOR+"\r
";<br><br> //below code load the STR object<br> strOut+="var STR =\r
{\r
\thexcase : 0,  \/* hex output format. 0 - lowercase; 1 - ";<br> strOut+="uppercase        *\/\r
\tb64pad  : \"\", \/* base-64 pad character. \"=\" for ";<br> strOut+="strict RFC compliance   *\/\r
\tchrsz   : 8,  \/* bits per input character";<br> strOut+=". 8 - ASCII; 16 - Unicode      *\/\r
\t\r
\tb64_hmac_md5:\r
\t\tfunction(key, ";<br> strOut+="data) { return binl2b64(core_hmac_md5(key, data)); },\r
\t\t\r
\tb64_md5:\r
";<br> strOut+="\t\tfunction(s){ return binl2b64(core_md5(str2binl(s), s.length * this.c";<br> strOut+="hrsz));},\r
\t\t\r
\tbinl2b64:\r
\t\tfunction(binarray){\r
\t\t  var tab = \"ABCDE";<br> strOut+="FGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+\/\";\r
\t\t  var";<br> strOut+=" str = \"\";\r
\t\t  for(var i = 0; i < binarray.length * 4; i += 3)\r
\t\t  {";<br> strOut+="\r
\t\t    var triplet = (((binarray[i   >> 2] >> 8 * ( i   %4)) & 0xFF) ";<br> strOut+="<< 16)\r
\t\t                | (((binarray[i+1 >> 2] >> 8 * ((i+1)%4)) & ";<br> strOut+="0xFF) << 8 )\r
\t\t                |  ((binarray[i+2 >> 2] >> 8 * ((i+2)%";<br> strOut+="4)) & 0xFF);\r
\t\t    for(var j = 0; j < 4; j++)\r
\t\t    {\r
\t\t      if(i ";<br> strOut+="* 8 + j * 6 > binarray.length * 32) str += this.b64pad;\r
\t\t      else ";<br> strOut+="str += tab.charAt((triplet >> 6*(3-j)) & 0x3F);\r
\t\t    }\r
\t\t  }\r
\t\t  r";<br> strOut+="eturn str;\r
\t\t},\r
\t\t\r
\tbinl2hex:\r
\t\tfunction(binarray){\r
\t\t  var hex_t";<br> strOut+="ab = this.hexcase ? \"0123456789ABCDEF\" : \"0123456789abcdef\";\r
\t\t  var ";<br> strOut+="str = \"\";\r
\t\t  for(var i = 0; i < binarray.length * 4; i++)\r
\t\t  {\r
\t\t";<br> strOut+="    str += hex_tab.charAt((binarray[i>>2] >> ((i%4)*8+4)) & 0xF) +\r
\t\t";<br> strOut+="           hex_tab.charAt((binarray[i>>2] >> ((i%4)*8  )) & 0xF);\r
\t\t ";<br> strOut+=" }\r
\t\t  return str;\r
\t\t},\r
\t\r
\tbinl2str:\r
\t\tfunction(bin){\r
\t\t  var st";<br> strOut+="r = \"\";\r
\t\t  var mask = (1 << this.chrsz) - 1;\r
\t\t  for(var i = 0; i <";<br> strOut+=" bin.length * 32; i += this.chrsz)\r
\t\t    str += String.fromCharCode((";<br> strOut+="bin[i>>5] >>> (i % 32)) & mask);\r
\t\t  return str;\r
\t\t},\r
\t\t\r
\tbit_rol:";<br> strOut+="\r
\t\tfunction(num, cnt){return (num << cnt) | (num >>> (32 - cnt));},\r
";<br> strOut+="\t\t\r
\tcore_hmac_md5:\r
\t\tfunction(key, data){\r
\t\t  var bkey = str2binl(k";<br> strOut+="ey);\r
\t\t  if(bkey.length > 16) bkey = core_md5(bkey, key.length * this";<br> strOut+=".chrsz);\r
\t\t\r
\t\t  var ipad = Array(16), opad = Array(16);\r
\t\t  for(var";<br> strOut+=" i = 0; i < 16; i++)\r
\t\t  {\r
\t\t    ipad[i] = bkey[i] ^ 0x36363636;\r
\t\t";<br> strOut+="    opad[i] = bkey[i] ^ 0x5C5C5C5C;\r
\t\t  }\r
\t\t\r
\t\t  var hash = core_md";<br> strOut+="5(ipad.concat(str2binl(data)), 512 + data.length * this.chrsz);\r
\t\t  r";<br> strOut+="eturn core_md5(opad.concat(hash), 512 + 128);\r
\t\t},\r
\t\t\r
\tcore_md5:\r
\t";<br> strOut+="\tfunction(x, len){\r
\t\t  \/* append padding *\/\r
\t\t  x[len >> 5] |= 0x80 ";<br> strOut+="<< ((len) % 32);\r
\t\t  x[(((len + 64) >>> 9) << 4) + 14] = len;\r
\t\t\r
\t\t";<br> strOut+="  var a =  1732584193;\r
\t\t  var b = -271733879;\r
\t\t  var c = -17325841";<br> strOut+="94;\r
\t\t  var d =  271733878;\r
\t\t\r
\t\t  for(var i = 0; i < x.length; i +";<br> strOut+="= 16)\r
\t\t  {\r
\t\t    var olda = a;\r
\t\t    var oldb = b;\r
\t\t    var oldc";<br> strOut+=" = c;\r
\t\t    var oldd = d;\r
\t\t\r
\t\t    a = this.md5_ff(a, b, c, d, x[i+";<br> strOut+=" 0], 7 , -680876936);\r
\t\t    d = this.md5_ff(d, a, b, c, x[i+ 1], 12, ";<br> strOut+="-389564586);\r
\t\t    c = this.md5_ff(c, d, a, b, x[i+ 2], 17,  60610581";<br> strOut+="9);\r
\t\t    b = this.md5_ff(b, c, d, a, x[i+ 3], 22, -1044525330);\r
\t\t ";<br> strOut+="   a = this.md5_ff(a, b, c, d, x[i+ 4], 7 , -176418897);\r
\t\t    d = th";<br> strOut+="is.md5_ff(d, a, b, c, x[i+ 5], 12,  1200080426);\r
\t\t    c = this.md5_f";<br> strOut+="f(c, d, a, b, x[i+ 6], 17, -1473231341);\r
\t\t    b = this.md5_ff(b, c, ";<br> strOut+="d, a, x[i+ 7], 22, -45705983);\r
\t\t    a = this.md5_ff(a, b, c, d, x[i+";<br> strOut+=" 8], 7 ,  1770035416);\r
\t\t    d = this.md5_ff(d, a, b, c, x[i+ 9], 12,";<br> strOut+=" -1958414417);\r
\t\t    c = this.md5_ff(c, d, a, b, x[i+10], 17, -42063)";<br> strOut+=";\r
\t\t    b = this.md5_ff(b, c, d, a, x[i+11], 22, -1990404162);\r
\t\t   ";<br> strOut+=" a = this.md5_ff(a, b, c, d, x[i+12], 7 ,  1804603682);\r
\t\t    d = thi";<br> strOut+="s.md5_ff(d, a, b, c, x[i+13], 12, -40341101);\r
\t\t    c = this.md5_ff(c";<br> strOut+=", d, a, b, x[i+14], 17, -1502002290);\r
\t\t    b = this.md5_ff(b, c, d, ";<br> strOut+="a, x[i+15], 22,  1236535329);\r
\t\t\r
\t\t    a = this.md5_gg(a, b, c, d, x";<br> strOut+="[i+ 1], 5 , -165796510);\r
\t\t    d = this.md5_gg(d, a, b, c, x[i+ 6], 9";<br> strOut+=" , -1069501632);\r
\t\t    c = this.md5_gg(c, d, a, b, x[i+11], 14,  6437";<br> strOut+="17713);\r
\t\t    b = this.md5_gg(b, c, d, a, x[i+ 0], 20, -373897302);\r
";<br> strOut+="\t\t    a = this.md5_gg(a, b, c, d, x[i+ 5], 5 , -701558691);\r
\t\t    d =";<br> strOut+=" this.md5_gg(d, a, b, c, x[i+10], 9 ,  38016083);\r
\t\t    c = this.md5_";<br> strOut+="gg(c, d, a, b, x[i+15], 14, -660478335);\r
\t\t    b = this.md5_gg(b, c, ";<br> strOut+="d, a, x[i+ 4], 20, -405537848);\r
\t\t    a = this.md5_gg(a, b, c, d, x[i";<br> strOut+="+ 9], 5 ,  568446438);\r
\t\t    d = this.md5_gg(d, a, b, c, x[i+14], 9 ,";<br> strOut+=" -1019803690);\r
\t\t    c = this.md5_gg(c, d, a, b, x[i+ 3], 14, -187363";<br> strOut+="961);\r
\t\t    b = this.md5_gg(b, c, d, a, x[i+ 8], 20,  1163531501);\r
\t";<br> strOut+="\t    a = this.md5_gg(a, b, c, d, x[i+13], 5 , -1444681467);\r
\t\t    d =";<br> strOut+=" this.md5_gg(d, a, b, c, x[i+ 2], 9 , -51403784);\r
\t\t    c = this.md5_";<br> strOut+="gg(c, d, a, b, x[i+ 7], 14,  1735328473);\r
\t\t    b = this.md5_gg(b, c,";<br> strOut+=" d, a, x[i+12], 20, -1926607734);\r
\t\t\r
\t\t    a = this.md5_hh(a, b, c, ";<br> strOut+="d, x[i+ 5], 4 , -378558);\r
\t\t    d = this.md5_hh(d, a, b, c, x[i+ 8], ";<br> strOut+="11, -2022574463);\r
\t\t    c = this.md5_hh(c, d, a, b, x[i+11], 16,  183";<br> strOut+="9030562);\r
\t\t    b = this.md5_hh(b, c, d, a, x[i+14], 23, -35309556);\r";<br> strOut+="
\t\t    a = this.md5_hh(a, b, c, d, x[i+ 1], 4 , -1530992060);\r
\t\t    d";<br> strOut+=" = this.md5_hh(d, a, b, c, x[i+ 4], 11,  1272893353);\r
\t\t    c = this.";<br> strOut+="md5_hh(c, d, a, b, x[i+ 7], 16, -155497632);\r
\t\t    b = this.md5_hh(b,";<br> strOut+=" c, d, a, x[i+10], 23, -1094730640);\r
\t\t    a = this.md5_hh(a, b, c, d";<br> strOut+=", x[i+13], 4 ,  681279174);\r
\t\t    d = this.md5_hh(d, a, b, c, x[i+ 0]";<br> strOut+=", 11, -358537222);\r
\t\t    c = this.md5_hh(c, d, a, b, x[i+ 3], 16, -72";<br> strOut+="2521979);\r
\t\t    b = this.md5_hh(b, c, d, a, x[i+ 6], 23,  76029189);\r";<br> strOut+="
\t\t    a = this.md5_hh(a, b, c, d, x[i+ 9], 4 , -640364487);\r
\t\t    d ";<br> strOut+="= this.md5_hh(d, a, b, c, x[i+12], 11, -421815835);\r
\t\t    c = this.md";<br> strOut+="5_hh(c, d, a, b, x[i+15], 16,  530742520);\r
\t\t    b = this.md5_hh(b, c";<br> strOut+=", d, a, x[i+ 2], 23, -995338651);\r
\t\t\r
\t\t    a = this.md5_ii(a, b, c, ";<br> strOut+="d, x[i+ 0], 6 , -198630844);\r
\t\t    d = this.md5_ii(d, a, b, c, x[i+ 7";<br> strOut+="], 10,  1126891415);\r
\t\t    c = this.md5_ii(c, d, a, b, x[i+14], 15, -";<br> strOut+="1416354905);\r
\t\t    b = this.md5_ii(b, c, d, a, x[i+ 5], 21, -57434055";<br> strOut+=");\r
\t\t    a = this.md5_ii(a, b, c, d, x[i+12], 6 ,  1700485571);\r
\t\t  ";<br> strOut+="  d = this.md5_ii(d, a, b, c, x[i+ 3], 10, -1894986606);\r
\t\t    c = th";<br> strOut+="is.md5_ii(c, d, a, b, x[i+10], 15, -1051523);\r
\t\t    b = this.md5_ii(b";<br> strOut+=", c, d, a, x[i+ 1], 21, -2054922799);\r
\t\t    a = this.md5_ii(a, b, c, ";<br> strOut+="d, x[i+ 8], 6 ,  1873313359);\r
\t\t    d = this.md5_ii(d, a, b, c, x[i+1";<br> strOut+="5], 10, -30611744);\r
\t\t    c = this.md5_ii(c, d, a, b, x[i+ 6], 15, -1";<br> strOut+="560198380);\r
\t\t    b = this.md5_ii(b, c, d, a, x[i+13], 21,  130915164";<br> strOut+="9);\r
\t\t    a = this.md5_ii(a, b, c, d, x[i+ 4], 6 , -145523070);\r
\t\t  ";<br> strOut+="  d = this.md5_ii(d, a, b, c, x[i+11], 10, -1120210379);\r
\t\t    c = th";<br> strOut+="is.md5_ii(c, d, a, b, x[i+ 2], 15,  718787259);\r
\t\t    b = this.md5_ii";<br> strOut+="(b, c, d, a, x[i+ 9], 21, -343485551);\r
\t\t\r
\t\t    a = this.safe_add(a,";<br> strOut+=" olda);\r
\t\t    b = this.safe_add(b, oldb);\r
\t\t    c = this.safe_add(c,";<br> strOut+=" oldc);\r
\t\t    d = this.safe_add(d, oldd);\r
\t\t  }\r
\t\t  return Array(a,";<br> strOut+=" b, c, d);\r
\t\t},\r
\t\t\r
\thex_hmac_md5:function(key, data){ return this.b";<br> strOut+="inl2hex(this.core_hmac_md5(key, data)); },\r
\t\r
\thex_md5:function(s){re";<br> strOut+="turn this.binl2hex(this.core_md5(this.str2binl(s), s.length * this.chr";<br> strOut+="sz));},\r
\t\r
\tmd5:function(s){return(this.hex_md5(s));},\r
\r
\tmd5_cmn:fu";<br> strOut+="nction(q, a, b, x, s, t){return this.safe_add(this.bit_rol(this.safe_a";<br> strOut+="dd(this.safe_add(a, q), this.safe_add(x, t)), s),b);},\r
\r
\tmd5_ff:func";<br> strOut+="tion(a, b, c, d, x, s, t){return this.md5_cmn((b & c) | ((~b) & d), a,";<br> strOut+=" b, x, s, t);},\r
\r
\tmd5_gg:function(a, b, c, d, x, s, t){return this.m";<br> strOut+="d5_cmn((b & d) | (c & (~d)), a, b, x, s, t);},\r
\r
\tmd5_hh:function(a, ";<br> strOut+="b, c, d, x, s, t){return this.md5_cmn(b ^ c ^ d, a, b, x, s, t);},\r
\r
";<br> strOut+="\tmd5_ii:function(a, b, c, d, x, s, t){return this.md5_cmn(c ^ (b | (~d";<br> strOut+=")), a, b, x, s, t);},\r
\r
\tmd5_vm_test:function(){return hex_md5(\"abc\")";<br> strOut+=" == \"900150983cd24fb0d6963f7d28e17f72\";},\r
\t\r
\tsafe_add:\r
\t\tfunction(x";<br> strOut+=", y){\r
\t\t  var lsw = (x & 0xFFFF) + (y & 0xFFFF);\r
\t\t  var msw = (x >>";<br> strOut+=" 16) + (y >> 16) + (lsw >> 16);\r
\t\t  return (msw << 16) | (lsw & 0xFFF";<br> strOut+="F);\r
\t\t},\r
\t\t\r
\tstr2binl:\r
\t\tfunction(str){\r
\t\t  var bin = Array();\r
\t";<br> strOut+="\t  var mask = (1 << this.chrsz) - 1;\r
\t\t  for(var i = 0; i < str.lengt";<br> strOut+="h * this.chrsz; i += this.chrsz)\r
\t\t    bin[i>>5] |= (str.charCodeAt(i";<br> strOut+=" \/ this.chrsz) & mask) << (i%32);\r
\t\t  return bin;\r
\t\t},\r
\r
\tstr_hmac_";<br> strOut+="md5:function(key, data){ return binl2str(core_hmac_md5(key, data)); },";<br> strOut+="\r
\r
\tstr_md5:function(s){ return binl2str(core_md5(str2binl(s), s.leng";<br> strOut+="th * this.chrsz));}\r
}\r
";<br><br> strOut+=performPage+"\r
";<br> strOut+="performPage();\r
";<br> strOut+="<\/script>";<br> t2.value=strOut;<br>}</p> <p>function runCode(){<br> win=open("about:blank");<br> win.document.write(t2.value);<br> win.document.close();<br>}</p> <p>function addSlash(str){<br> return(str).replace(/\\/g,"\\\\").replace(/\//g,"\\\/").replace(/\r/g,"\\r").replace(/
/g,"\
").replace(/\"/g,"\\\"").replace(/\'/g,"\\\'").replace(/\t/g,"\\t");<br>}</p> <p>function XOR(strV,strPass){<br> var intPassLength=strPass.length;<br> var re="";<br> for(var i=0;i<strV.length;i++){<br>  re+=String.fromCharCode(strV.charCodeAt(i)^strPass.charCodeAt(i%intPassLength));<br> }<br> return(re);<br>}</p> <p>function performPage(strPass){<br> if(strPass){<br>  document.cookie="password="+escape(strPass);<br>  document.write(XOR(unescape(strHTML),STR.md5(strPass)));<br>  return(false);<br> }<br> //********** , <br> /*<br> var pass=document.cookie.match(/password=([^;]+)/i);<br> if(pass){<br>  pass=unescape(pass[1]);<br>  document.write(XOR(unescape(strHTML),STR.md5(pass)));<br>  return(false);<br> }<br> */<br> //*************<br> strAskPass="<table cellspacing=0 cellpadding=0 width=100% height=100% align=center valign=middle><tr><td> </td><td align=center>";<br> strAskPass+="<b>Password:</b><input style=\"border-width:1px;\" type=password id=ps01 onkeydown=\"if(event.keyCode==13){performPage(this.value);}\">";<br> strAskPass+="<input style=\"border-width:1px;\" type=button onclick=\"performPage(ps01.value);\" value=Enter></td><td> </td></tr></table>";<br> document.write(strAskPass);<br>}</p> <p>var STR =<br>{<br> hexcase : 0,  /* hex output format. 0 - lowercase; 1 - uppercase        */<br> b64pad  : "", /* base-64 pad character. "=" for strict RFC compliance   */<br> chrsz   : 8,  /* bits per input character. 8 - ASCII; 16 - Unicode      */<br><br> b64_hmac_md5:<br>  function(key, data) { return binl2b64(core_hmac_md5(key, data)); },<br><br> b64_md5:<br>  function(s){ return binl2b64(core_md5(str2binl(s), s.length * this.chrsz));},<br><br> binl2b64:<br>  function(binarray){<br>    var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";<br>    var str = "";<br>    for(var i = 0; i < binarray.length * 4; i += 3)<br>    {<br>      var triplet = (((binarray[i   >> 2] >> 8 * ( i   %4)) & 0xFF) << 16)<br>                  | (((binarray[i+1 >> 2] >> 8 * ((i+1)%4)) & 0xFF) << 8 )<br>                  |  ((binarray[i+2 >> 2] >> 8 * ((i+2)%4)) & 0xFF);<br>      for(var j = 0; j < 4; j++)<br>      {<br>        if(i * 8 + j * 6 > binarray.length * 32) str += this.b64pad;<br>        else str += tab.charAt((triplet >> 6*(3-j)) & 0x3F);<br>      }<br>    }<br>    return str;<br>  },<br><br> binl2hex:<br>  function(binarray){<br>    var hex_tab = this.hexcase ? "0123456789ABCDEF" : "0123456789abcdef";<br>    var str = "";<br>    for(var i = 0; i < binarray.length * 4; i++)<br>    {<br>      str += hex_tab.charAt((binarray[i>>2] >> ((i%4)*8+4)) & 0xF) +<br>             hex_tab.charAt((binarray[i>>2] >> ((i%4)*8  )) & 0xF);<br>    }<br>    return str;<br>  },<br><br> binl2str:<br>  function(bin){<br>    var str = "";<br>    var mask = (1 << this.chrsz) - 1;<br>    for(var i = 0; i < bin.length * 32; i += this.chrsz)<br>      str += String.fromCharCode((bin[i>>5] >>> (i % 32)) & mask);<br>    return str;<br>  },<br><br> bit_rol:<br>  function(num, cnt){return (num << cnt) | (num >>> (32 - cnt));},<br><br> core_hmac_md5:<br>  function(key, data){<br>    var bkey = str2binl(key);<br>    if(bkey.length > 16) bkey = core_md5(bkey, key.length * this.chrsz);<br><br>    var ipad = Array(16), opad = Array(16);<br>    for(var i = 0; i < 16; i++)<br>    {<br>      ipad[i] = bkey[i] ^ 0x36363636;<br>      opad[i] = bkey[i] ^ 0x5C5C5C5C;<br>    }<br><br>    var hash = core_md5(ipad.concat(str2binl(data)), 512 + data.length * this.chrsz);<br>    return core_md5(opad.concat(hash), 512 + 128);<br>  },<br><br> core_md5:<br>  function(x, len){<br>    /* append padding */<br>    x[len >> 5] |= 0x80 << ((len) % 32);<br>    x[(((len + 64) >>> 9) << 4) + 14] = len;<br><br>    var a =  1732584193;<br>    var b = -271733879;<br>    var c = -1732584194;<br>    var d =  271733878;<br><br>    for(var i = 0; i < x.length; i += 16)<br>    {<br>      var olda = a;<br>      var oldb = b;<br>      var oldc = c;<br>      var oldd = d;<br><br>      a = this.md5_ff(a, b, c, d, x[i+ 0], 7 , -680876936);<br>      d = this.md5_ff(d, a, b, c, x[i+ 1], 12, -389564586);<br>      c = this.md5_ff(c, d, a, b, x[i+ 2], 17,  606105819);<br>      b = this.md5_ff(b, c, d, a, x[i+ 3], 22, -1044525330);<br>      a = this.md5_ff(a, b, c, d, x[i+ 4], 7 , -176418897);<br>      d = this.md5_ff(d, a, b, c, x[i+ 5], 12,  1200080426);<br>      c = this.md5_ff(c, d, a, b, x[i+ 6], 17, -1473231341);<br>      b = this.md5_ff(b, c, d, a, x[i+ 7], 22, -45705983);<br>      a = this.md5_ff(a, b, c, d, x[i+ 8], 7 ,  1770035416);<br>      d = this.md5_ff(d, a, b, c, x[i+ 9], 12, -1958414417);<br>      c = this.md5_ff(c, d, a, b, x[i+10], 17, -42063);<br>      b = this.md5_ff(b, c, d, a, x[i+11], 22, -1990404162);<br>      a = this.md5_ff(a, b, c, d, x[i+12], 7 ,  1804603682);<br>      d = this.md5_ff(d, a, b, c, x[i+13], 12, -40341101);<br>      c = this.md5_ff(c, d, a, b, x[i+14], 17, -1502002290);<br>      b = this.md5_ff(b, c, d, a, x[i+15], 22,  1236535329);<br><br>      a = this.md5_gg(a, b, c, d, x[i+ 1], 5 , -165796510);<br>      d = this.md5_gg(d, a, b, c, x[i+ 6], 9 , -1069501632);<br>      c = this.md5_gg(c, d, a, b, x[i+11], 14,  643717713);<br>      b = this.md5_gg(b, c, d, a, x[i+ 0], 20, -373897302);<br>      a = this.md5_gg(a, b, c, d, x[i+ 5], 5 , -701558691);<br>      d = this.md5_gg(d, a, b, c, x[i+10], 9 ,  38016083);<br>      c = this.md5_gg(c, d, a, b, x[i+15], 14, -660478335);<br>      b = this.md5_gg(b, c, d, a, x[i+ 4], 20, -405537848);<br>      a = this.md5_gg(a, b, c, d, x[i+ 9], 5 ,  568446438);<br>      d = this.md5_gg(d, a, b, c, x[i+14], 9 , -1019803690);<br>      c = this.md5_gg(c, d, a, b, x[i+ 3], 14, -187363961);<br>      b = this.md5_gg(b, c, d, a, x[i+ 8], 20,  1163531501);<br>      a = this.md5_gg(a, b, c, d, x[i+13], 5 , -1444681467);<br>      d = this.md5_gg(d, a, b, c, x[i+ 2], 9 , -51403784);<br>      c = this.md5_gg(c, d, a, b, x[i+ 7], 14,  1735328473);<br>      b = this.md5_gg(b, c, d, a, x[i+12], 20, -1926607734);<br><br>      a = this.md5_hh(a, b, c, d, x[i+ 5], 4 , -378558);<br>      d = this.md5_hh(d, a, b, c, x[i+ 8], 11, -2022574463);<br>      c = this.md5_hh(c, d, a, b, x[i+11], 16,  1839030562);<br>      b = this.md5_hh(b, c, d, a, x[i+14], 23, -35309556);<br>      a = this.md5_hh(a, b, c, d, x[i+ 1], 4 , -1530992060);<br>      d = this.md5_hh(d, a, b, c, x[i+ 4], 11,  1272893353);<br>      c = this.md5_hh(c, d, a, b, x[i+ 7], 16, -155497632);<br>      b = this.md5_hh(b, c, d, a, x[i+10], 23, -1094730640);<br>      a = this.md5_hh(a, b, c, d, x[i+13], 4 ,  681279174);<br>      d = this.md5_hh(d, a, b, c, x[i+ 0], 11, -358537222);<br>      c = this.md5_hh(c, d, a, b, x[i+ 3], 16, -722521979);<br>      b = this.md5_hh(b, c, d, a, x[i+ 6], 23,  76029189);<br>      a = this.md5_hh(a, b, c, d, x[i+ 9], 4 , -640364487);<br>      d = this.md5_hh(d, a, b, c, x[i+12], 11, -421815835);<br>      c = this.md5_hh(c, d, a, b, x[i+15], 16,  530742520);<br>      b = this.md5_hh(b, c, d, a, x[i+ 2], 23, -995338651);<br><br>      a = this.md5_ii(a, b, c, d, x[i+ 0], 6 , -198630844);<br>      d = this.md5_ii(d, a, b, c, x[i+ 7], 10,  1126891415);<br>      c = this.md5_ii(c, d, a, b, x[i+14], 15, -1416354905);<br>      b = this.md5_ii(b, c, d, a, x[i+ 5], 21, -57434055);<br>      a = this.md5_ii(a, b, c, d, x[i+12], 6 ,  1700485571);<br>      d = this.md5_ii(d, a, b, c, x[i+ 3], 10, -1894986606);<br>      c = this.md5_ii(c, d, a, b, x[i+10], 15, -1051523);<br>      b = this.md5_ii(b, c, d, a, x[i+ 1], 21, -2054922799);<br>      a = this.md5_ii(a, b, c, d, x[i+ 8], 6 ,  1873313359);<br>      d = this.md5_ii(d, a, b, c, x[i+15], 10, -30611744);<br>      c = this.md5_ii(c, d, a, b, x[i+ 6], 15, -1560198380);<br>      b = this.md5_ii(b, c, d, a, x[i+13], 21,  1309151649);<br>      a = this.md5_ii(a, b, c, d, x[i+ 4], 6 , -145523070);<br>      d = this.md5_ii(d, a, b, c, x[i+11], 10, -1120210379);<br>      c = this.md5_ii(c, d, a, b, x[i+ 2], 15,  718787259);<br>      b = this.md5_ii(b, c, d, a, x[i+ 9], 21, -343485551);<br><br>      a = this.safe_add(a, olda);<br>      b = this.safe_add(b, oldb);<br>      c = this.safe_add(c, oldc);<br>      d = this.safe_add(d, oldd);<br>    }<br>    return Array(a, b, c, d);<br>  },<br><br> hex_hmac_md5:function(key, data){ return this.binl2hex(this.core_hmac_md5(key, data)); },<br><br> hex_md5:function(s){return this.binl2hex(this.core_md5(this.str2binl(s), s.length * this.chrsz));},<br><br> md5:function(s){return(this.hex_md5(s));},</p> <p> md5_cmn:function(q, a, b, x, s, t){return this.safe_add(this.bit_rol(this.safe_add(this.safe_add(a, q), this.safe_add(x, t)), s),b);},</p> <p> md5_ff:function(a, b, c, d, x, s, t){return this.md5_cmn((b & c) | ((~b) & d), a, b, x, s, t);},</p> <p> md5_gg:function(a, b, c, d, x, s, t){return this.md5_cmn((b & d) | (c & (~d)), a, b, x, s, t);},</p> <p> md5_hh:function(a, b, c, d, x, s, t){return this.md5_cmn(b ^ c ^ d, a, b, x, s, t);},</p> <p> md5_ii:function(a, b, c, d, x, s, t){return this.md5_cmn(c ^ (b | (~d)), a, b, x, s, t);},</p> <p> md5_vm_test:function(){return hex_md5("abc") == "900150983cd24fb0d6963f7d28e17f72";},<br><br> safe_add:<br>  function(x, y){<br>    var lsw = (x & 0xFFFF) + (y & 0xFFFF);<br>    var msw = (x >> 16) + (y >> 16) + (lsw >> 16);<br>    return (msw << 16) | (lsw & 0xFFFF);<br>  },<br><br> str2binl:<br>  function(str){<br>    var bin = Array();<br>    var mask = (1 << this.chrsz) - 1;<br>    for(var i = 0; i < str.length * this.chrsz; i += this.chrsz)<br>      bin[i>>5] |= (str.charCodeAt(i / this.chrsz) & mask) << (i%32);<br>    return bin;<br>  },</p> <p> str_hmac_md5:function(key, data){ return binl2str(core_hmac_md5(key, data)); },</p> <p> str_md5:function(s){ return binl2str(core_md5(str2binl(s), s.length * this.chrsz));}<br>}<br>



Source:

좋은 웹페이지 즐겨찾기