JavaScript script implements static page encryption instance code _javascript tips

Source: Internet
Author: User
Tags lowercase md5 md5 encryption rfc

JavaScript script to achieve static Web page encryption, reading JavaScript script to achieve static Web page encryption, two days ago to see someone ask static Web page encryption problem, wrote this code thinking: encryption: First of all, the user's key A with MD5 encryption for B, Then use B-XOR or source file S0 to get the target file S1, S1 into the JS variable. When decrypted: Ask for the key, and then operate the same encryption

Two days ago I saw someone ask static Web page encryption problem, wrote this code

Ideas:

Encryption: First the user's key A with MD5 encryption to B, and then use B-XOR or source file S0 get the target file S1, S1 into the JS variable.

When decrypted: Ask for the key and then operate with encryption.

Because of the use of MD5, individuals think that there is no key when the key is not cracked (except violence)

Let's try haha:

The source code is as follows:

Copy Code code as follows:



<html>


<head>


<title>web encoder</title>


<style>


Body {


font-size:12px;


line-height:12px;


Background-color:buttonface;


border-width:0px;


Overflow:auto;


margin:0px;


padding:4px;


}

#t1, #t2 {
width:100%;
height:40%;
border-width:1px;
Overflow:auto;
Height:expression ((document.body.clientheight-100)/2);
}

Input {


border-width:1px;


padding-left:10px;


padding-right:10px;


margin:4px;


}


</style>


<script>


function Webencode () {


Strsource=escape (XOR (T1.VALUE,STR.MD5 (P1.value));


Strsource=t1.value;


strout= "<script>\r\nstrhtml=\" \ "; \ r \ n";


for (Var i=0;i+70<strsource.length;i+=70) {


strout+= "Strhtml+=\" "+addslash (strsource.substring (i,i+70)) +" \ "; \ r \ n";


}


strout+= "Strhtml+=\" "+addslash (strsource.substring (i,strsource.length)) +" \ "; \ r \ n";


strout+=xor+ "\ r \ n";





Below code load the STR object


strout+= "var STR =\r\n{\r\n\thexcase:0, \/* hex output format. 0-lowercase; 1-";


strout+= "uppercase *\/\r\n\tb64pad: \", \/* base-64 pad character. \ "=\" for ";


strout+= "Strict RFC compliance *\/\r\n\tchrsz:8, \/* bits per input character";


strout+= ". 8-ascii; 16-unicode *\/\r\n\t\r\n\tb64_hmac_md5:\r\n\t\tfunction (Key, ";


strout+= "Data" {return binl2b64 (CORE_HMAC_MD5 (key, data);},\r\n\t\t\r\n\tb64_md5:\r\n ";


strout+= "\t\tfunction (s) {return binl2b64 (CORE_MD5 (Str2binl (s), s.length * THIS.C";


strout+= "Hrsz)"},\r\n\t\t\r\n\tbinl2b64:\r\n\t\tfunction (BinArray) {\r\n\t\t var tab = \ "ABCDE";


strout+= "fghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz0123456789+\/\"; \r\n\t\t var ";


strout+= "str = \" "\"; \r\n\t\t for (var i = 0; i < binarray.length * 4; i + + 3) \r\n\t\t {";


strout+= "\r\n\t\t var triplet = ((binarray[i >> 2] >> 8 * (i%4) & 0xFF)";


strout+= "<<) \r\n\t\t | (((binarray[i+1 >> 2] >> 8 * ((i+1)%4)) & ";


strout+= "0xFF) << 8) \r\n\t\t | ((binarray[i+2 >> 2] >> 8 * (i+2)%;


strout+= "4)" & 0xFF); \r\n\t\t for (var j = 0; J < 4; j +) \r\n\t\t {\r\n\t\t if (i);


strout+= "* 8 + J * 6 > Binarray.length *) str = this.b64pad;\r\n\t\t Else";


strout+= "str = tab.charat (triplet >> 6* (3-j)) & 0x3F); \r\n\t\t}\r\n\t\t}\r\n\t\t R";


strout+= "Eturn str;\r\n\t\t},\r\n\t\t\r\n\tbinl2hex:\r\n\t\tfunction (BinArray) {\r\n\t\t var hex_t";


strout+= "AB = This.hexcase?" \ "0123456789abcdef\": \ "0123456789abcdef\"; \r\n\t\t var ";


strout+= "str = \" \ "\r\n\t\t for (var i = 0; i < binarray.length * 4; i++) \r\n\t\t {\r\n\t\t";


strout+= "str = Hex_tab.charat ((binarray[i>>2) >> ((i%4) *8+4)) & 0xF) +\r\n\t\t";


strout+= "Hex_tab.charat (Binarray[i>>2] >> ((i%4) *8)) & 0xF); \r\n\t\t";


strout+= "}\r\n\t\t return str;\r\n\t\t},\r\n\t\r\n\tbinl2str:\r\n\t\tfunction (bin) {\r\n\t\t var st";


strout+= "r = \"; \r\n\t\t var mask = (1 << this.chrsz)-1;\r\n\t\t for (var i = 0; i <;


strout+= "Bin.length * 32; i + = this.chrsz) \r\n\t\t str = String.fromCharCode (";


strout+= "bin[i>>5] >>> (i%)) & mask); \r\n\t\t return Str;\r\n\t\t},\r\n\t\t\r\n\tbit_rol:";


strout+= "\r\n\t\tfunction (num, cnt) {return (num << cnt) | (Num >>> (32-cnt));},\r\n ";


strout+= "\t\t\r\n\tcore_hmac_md5:\r\n\t\tfunction (key, data) {\r\n\t\t var bkey = str2binl (k";


strout+= "ey); \r\n\t\t if (Bkey.length >) bkey = Core_md5 (Bkey, key.length * this";


strout+= ". Chrsz); \r\n\t\t\r\n\t\t var ipad = array, Opad = Array (), \r\n\t\t for (VAR);


strout+= "i = 0; I < 16; i++) \r\n\t\t {\r\n\t\t Ipad[i] = bkey[i] ^ 0x36363636;\r\n\t\t ";


strout+= "opad[i] = bkey[i] ^ 0x5c5c5c5c;\r\n\t\t}\r\n\t\t\r\n\t\t var hash = CORE_MD";


strout+= "5 (STR2BINL (data), Ipad.concat + data.length * this.chrsz); \r\n\t\t R";


strout+= "Eturn core_md5 (Opad.concat (hash), 128); \r\n\t\t},\r\n\t\t\r\n\tcore_md5:\r\n\t";


strout+= "\tfunction (x, len) {\r\n\t\t \/* append padding *\/\r\n\t\t x[len >> 5] |= 0x80";


strout+= "<< ((len)%); \r\n\t\t x[((len +) >>> 9) << 4) + +] = len;\r\n\t\t\r\n\t\t";


Strout+= "var a = 1732584193;\r\n\t\t var B = -271733879;\r\n\t\t var c =-17325841";


strout+= "94;\r\n\t\t var d = 271733878;\r\n\t\t\r\n\t\t for (var i = 0; i < x.length; i +";


strout+= "=" \r\n\t\t {\r\n\t\t var Olda = a;\r\n\t\t var oldb = b;\r\n\t\t var oldc ";


strout+= "= c;\r\n\t\t var oldd = d;\r\n\t\t\r\n\t\t A = This.md5_ff (A, B, C, D, x[i+";


strout+= "0], 7, -680876936); \r\n\t\t d = this.md5_ff (d, a, B, C, x[i+ 1], 12,";


strout+= " -389564586); \r\n\t\t C = This.md5_ff (c, D, a, B, x[i+ 2], 17, 60610581";


strout+= "9); \r\n\t\t B = This.md5_ff (b, C, D, A, x[i+ 3], -1044525330); \r\n\t\t";


strout+= "a = This.md5_ff (A, B, C, D, x[i+ 4], 7, -176418897); \r\n\t\t d = th";


strout+= "Is.md5_ff (d, a, B, C, x[i+ 5], 1200080426); \r\n\t\t C = This.md5_f";


strout+= "F (c, D, a, B, x[i+ 6], -1473231341); \r\n\t\t B = This.md5_ff (b, C,";


strout+= "D, A, x[i+ 7], -45705983); \r\n\t\t a = This.md5_ff (A, B, C, D, x[i+";


strout+= "8], 7, 1770035416); \r\n\t\t d = this.md5_ff (d, a, B, C, x[i+ 9], 12,";


strout+= " -1958414417); \r\n\t\t C = This.md5_ff (c, D, a, B, x[i+10], 17,-42063)";


strout+= "; \r\n\t\t B = This.md5_ff (b, C, D, A, x[i+11], -1990404162); \r\n\t\t";


strout+= "a = This.md5_ff (A, B, C, D, X[i+12], 7, 1804603682); \r\n\t\t d = thi";


strout+= "S.md5_ff (d, a, B, C, x[i+13], -40341101); \r\n\t\t C = this.md5_ff (c);


strout+= ", D, a, B, x[i+14], -1502002290); \r\n\t\t B = This.md5_ff (b, C, D,";


strout+= "A, x[i+15], 1236535329); \r\n\t\t\r\n\t\t a = This.md5_gg (A, B, C, D, X";


strout+= "[i+ 1], 5, -165796510); \r\n\t\t d = This.md5_gg (d, a, B, C, x[i+ 6], 9";


strout+= ", -1069501632); \r\n\t\t C = This.md5_gg (c, D, a, B, x[i+11], 14, 6437";


strout+= "17713); \r\n\t\t B = This.md5_gg (b, C, D, A, x[i+ 0], -373897302); \ r \ n";


strout+= "\t\t a = This.md5_gg (A, B, C, D, x[i+ 5], 5, -701558691); \r\n\t\t d =";


strout+= "This.md5_gg (d, a, B, C, x[i+10], 9, 38016083); \r\n\t\t C = this.md5_";


strout+= "GG (c, D, a, B, x[i+15], -660478335); \r\n\t\t B = This.md5_gg (b, C,";


strout+= "D, A, x[i+ 4], -405537848); \r\n\t\t a = This.md5_gg (A, B, C, D, x[i";


strout+= "+ 9], 5, 568446438); \r\n\t\t d = This.md5_gg (d, a, B, C, x[i+14], 9,";


strout+= " -1019803690); \r\n\t\t C = This.md5_gg (c, D, a, B, x[i+ 3], 14,-187363";


strout+= "961); \r\n\t\t B = This.md5_gg (b, C, D, A, x[i+ 8], 1163531501); \r\n\t";


strout+= "t a = This.md5_gg (A, B, C, D, X[i+13], 5, -1444681467); \r\n\t\t d =";


strout+= "This.md5_gg (d, a, B, C, x[i+ 2], 9, -51403784); \r\n\t\t C = this.md5_";


strout+= "GG (c, D, a, B, x[i+ 7], 1735328473); \r\n\t\t B = This.md5_gg (b, C,";


strout+= "D, A, x[i+12], -1926607734); \r\n\t\t\r\n\t\t a = This.md5_hh (A, B, C,";


strout+= "D, x[i+ 5], 4, -378558); \r\n\t\t d = this.md5_hh (d, a, B, C, x[i+ 8],";


strout+= "one, -2022574463); \r\n\t\t C = this.md5_hh (c, D, a, B, x[i+11], 16, 183";


strout+= "9030562); \r\n\t\t B = this.md5_hh (b, C, D, A, x[i+14], -35309556); \ r";


strout+= "\n\t\t a = This.md5_hh (A, B, C, D, x[i+ 1], 4, -1530992060); \r\n\t\t d";


strout+= "= this.md5_hh (d, a, B, C, x[i+ 4], one, 1272893353); \r\n\t\t C = this.";


strout+= "Md5_hh (c, D, a, B, x[i+ 7], -155497632); \r\n\t\t B = this.md5_hh (b,";


strout+= "C, D, A, x[i+10], -1094730640); \r\n\t\t a = This.md5_hh (A, B, C, D";


strout+= ", X[i+13], 4, 681279174); \r\n\t\t d = this.md5_hh (d, a, B, C, x[i+ 0]";


Strout+= ", one, -358537222); \r\n\t\t C = this.md5_hh (c, D, a, B, x[i+ 3], 16,-72";


strout+= "2521979); \r\n\t\t B = this.md5_hh (b, C, D, A, x[i+ 6], 76029189); \ r";


strout+= "\n\t\t a = This.md5_hh (A, B, C, D, x[i+ 9], 4, -640364487); \r\n\t\t d";


strout+= "= this.md5_hh (d, a, B, C, x[i+12], one, -421815835); \r\n\t\t C = this.md";


strout+= "5_hh (c, D, a, B, x[i+15], 530742520); \r\n\t\t B = this.md5_hh (b, c);


strout+= ", D, A, x[i+ 2], -995338651); \r\n\t\t\r\n\t\t a = This.md5_ii (A, B, C,";


strout+= "D, x[i+ 0], 6, -198630844); \r\n\t\t d = This.md5_ii (d, a, B, C, x[i+ 7";


strout+= "], ten, 1126891415); \r\n\t\t C = This.md5_ii (c, D, a, B, x[i+14], 15,-";


strout+= "1416354905); \r\n\t\t B = This.md5_ii (b, C, D, A, x[i+ 5], 21,-57434055";


strout+= "); \r\n\t\t a = This.md5_ii (A, B, C, D, X[i+12], 6, 1700485571); \r\n\t\t";


strout+= "D = This.md5_ii (d, a, B, C, x[i+ 3], ten, -1894986606); \r\n\t\t c = th";


strout+= "Is.md5_ii (c, D, a, B, x[i+10], -1051523); \r\n\t\t B = This.md5_ii (b);


strout+= ", C, D, A, x[i+ 1], -2054922799); \r\n\t\t a = This.md5_ii (A, B, C,";


strout+= "D, x[i+ 8], 6, 1873313359); \r\n\t\t d = This.md5_ii (d, a, B, C, x[i+1";


strout+= "5], -30611744); \r\n\t\t C = This.md5_ii (c, D, a, B, x[i+ 6], 15,-1";


strout+= "560198380); \r\n\t\t B = This.md5_ii (b, C, D, A, x[i+13], 21, 130915164";


strout+= "9); \r\n\t\t a = This.md5_ii (A, B, C, D, x[i+ 4], 6, -145523070); \r\n\t\t";


strout+= "D = This.md5_ii (d, a, B, C, x[i+11], -1120210379); \r\n\t\t c = th";


strout+= "Is.md5_ii (c, D, a, B, x[i+ 2], 718787259); \r\n\t\t B = This.md5_ii";


strout+= "(b, C, D, A, x[i+ 9], -343485551); \r\n\t\t\r\n\t\t a = This.safe_add (A,";


strout+= "Olda); \r\n\t\t B = This.safe_add (b, oldb); \r\n\t\t C = This.safe_add (C,";


strout+= "OLDC); \r\n\t\t d = This.safe_add (d, OLDD); \r\n\t\t}\r\n\t\t return Array (A,";


strout+= "B, C, D); \r\n\t\t},\r\n\t\t\r\n\thex_hmac_md5:function (key, data) {return this.b";


strout+= "Inl2hex (THIS.CORE_HMAC_MD5 (key, data)); },\r\n\t\r\n\thex_md5:function (s) {re;


strout+= "Turn This.binl2hex (THIS.CORE_MD5 (This.str2binl (s), s.length * THIS.CHR";


strout+= "sz");},\r\n\t\r\n\tmd5:function (s) {return (THIS.HEX_MD5 (s));},\r\n\r\n\tmd5_cmn:fu ";


strout+= "Nction" (Q, A, B, X, S, t) {return This.safe_add (This.bit_rol (this.safe_a);


strout+= "DD (This.safe_add (A, Q), This.safe_add (x, T)), s), b);},\r\n\r\n\tmd5_ff:func";


strout+= "tion (A, B, C, D, X, S, t) {return this.md5_cmn (b & c) | ((~b) & D), A, ";


strout+= "B, X, S, t);},\r\n\r\n\tmd5_gg:function (A, B, C, D, X, S, t) {return THIS.M";


strout+= "D5_CMN (b & D) | (C & (~d)), A, B, X, S, t);},\r\n\r\n\tmd5_hh:function (A, ";


strout+= "B, C, D, X, S, t) {return this.md5_cmn (b ^ C ^ D, a, B, X, S, t);},\r\n\r\n";


strout+= "\tmd5_ii:function (A, B, C, D, X, S, t) {return this.md5_cmn (c ^) (b | (~d ";


strout+= ")), A, B, X, S, t);},\r\n\r\n\tmd5_vm_test:function () {return hex_md5 (\" abc\ ")";


strout+= "= = 900150983cd24fb0d6963f7d28e17f72\";},\r\n\t\r\n\tsafe_add:\r\n\t\tfunction (x);


strout+= ", y) {\r\n\t\t var LSW = (x & 0xFFFF) + (Y & 0xFFFF); \r\n\t\t var MSW = (x >>;


strout+= + (y >>) + (LSW >>) \r\n\t\t return (MSW << 16) | (LSW & 0xFFF ";


strout+= "F); \r\n\t\t},\r\n\t\t\r\n\tstr2binl:\r\n\t\tfunction (str) {\r\n\t\t var bin = Array (); \r\n\t";


strout+= "\ t var mask = (1 << this.chrsz)-1;\r\n\t\t for (var i = 0; i < str.lengt";


strout+= "H * THIS.CHRSZ; i + = This.chrsz) \r\n\t\t bin[i>>5] |= (Str.charcodeat (i);


strout+= "\/This.chrsz) & Mask) << (i%32); \r\n\t\t return bin;\r\n\t\t},\r\n\r\n\tstr_hmac_";


strout+= "Md5:function (key, data) {return binl2str (CORE_HMAC_MD5 (key, data);},";


strout+= "\r\n\r\n\tstr_md5:function (s) {return binl2str (CORE_MD5 (Str2binl (s), S.leng";


strout+= "th * this.chrsz)");} \r\n}\r\n ";





Strout+=performpage+ "\ r \ n";


strout+= "performpage (); \ r \ n";


strout+= "<\/script>";


T2.value=strout;


}

function RunCode () {
Win=open ("About:blank");
Win.document.write (T2.value);
Win.document.close ();
}

function Addslash (str) {
Return (str). replace (/\\/g, "\\\\"). Replace (/\//g, "\\\/"). Replace (/\r/g, "\ r"). Replace (/\n/g, "\\n"). Replace (/\ "/ G, "\\\"). Replace (/\ '/g, "\\\"). Replace (/\t/g, "\\t");
}

function XOR (strv,strpass) {
var intpasslength=strpass.length;
var re= "";
for (Var i=0;i<strv.length;i++) {
Re+=string.fromcharcode (Strv.charcodeat (i) ^strpass.charcodeat (i%intpasslength));
}
return (re);
}

function Performpage (strpass) {


if (Strpass) {


Document.cookie= "password=" +escape (Strpass);


document.write (XOR (unescape (strhtml), STR.MD5 (Strpass)));


return (false);


}


If you need to remember your password automatically, change the following comment to code


/*


var pass=document.cookie.match (/password=) ([^;] +)/i);


if (pass) {


Pass=unescape (Pass[1]);


document.write (XOR (unescape (strhtml), STR.MD5 (pass));


return (false);


}


*/


//*************


straskpass= "&lt;table cellspacing=0 cellpadding=0 width=100% height=100% align=center valign=middle&gt;&lt;tr&gt; &lt;td&gt; &lt;/td&gt;&lt;td align=center&gt; ";


straskpass+= "&lt;b&gt;password:&lt;/b&gt;&lt;input style=\" border-width:1px;\ "Type=password id=ps01" if (event.keycode==13) {performpage (this.value);} \ "&gt;";


straskpass+= "&lt;input style=\" border-width:1px;\ "Type=button onclick=\" Performpage (ps01.value); \ "Value=Enter &gt;&lt;/td&gt;&lt;td&gt; &lt;/td&gt;&lt;/tr&gt;&lt;/table&gt; ";


document.write (Straskpass);


}

var STR =


{


hexcase:0,/* Hex output format. 0-lowercase; 1-uppercase *


B64pad: ", * * base-64 pad character." = "for strict RFC compliance * * *


Chrsz:8,/* bits per input character. 8-ascii; 16-unicode *





B64_HMAC_MD5:


function (key, data) {return binl2b64 (CORE_HMAC_MD5 (key, data));





B64_MD5:


function (s) {return binl2b64 (CORE_MD5 (Str2binl (s), s.length * This.chrsz));





BINL2B64:


function (BinArray) {


var tab = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz0123456789+/";


var str = "";


for (var i = 0; i &lt; binarray.length * 4; i + + 3)


{


var triplet = ((binarray[i &gt;&gt; 2] &gt;&gt; 8 * (i%4) &amp; 0xFF) &lt;&lt; 16)


| (((binarray[i+1 &gt;&gt; 2] &gt;&gt; 8 * ((i+1)%4)) &amp; 0xFF) &lt;&lt; 8)


| ((binarray[i+2 &gt;&gt; 2] &gt;&gt; 8 * ((i+2)%4)) &amp; 0xFF);


for (var j = 0; J &lt; 4; J + +)


{


if (I * 8 + J * 6 &gt; Binarray.length *) str + = This.b64pad;


else str = Tab.charat ((triplet &gt;&gt; 6* (3-j)) &amp; 0x3F);


}


}


return str;


},





Binl2hex:


function (BinArray) {


var hex_tab = this.hexcase? "0123456789ABCDEF": "0123456789abcdef";


var str = "";


for (var i = 0; i &lt; binarray.length * 4; i++)


{


str = Hex_tab.charat ((binarray[i&gt;&gt;2] &gt;&gt; ((i%4) *8+4)) &amp; 0xF) +


Hex_tab.charat ((Binarray[i&gt;&gt;2] &gt;&gt; ((i%4) *8)) &amp; 0xF);


}


return str;


},





BINL2STR:


function (BIN) {


var str = "";


var mask = (1 &lt;&lt; this.chrsz)-1;


for (var i = 0; i &lt; bin.length * i + + = This.chrsz)


str = String.fromCharCode ((bin[i&gt;&gt;5] &gt;&gt;&gt; (i%)) &amp; mask);


return str;


},





Bit_rol:


function (num, CNT) {return (num &lt;&lt; cnt) | (Num &gt;&gt;&gt; (32-cnt));},





CORE_HMAC_MD5:


function (key, data) {


var bkey = str2binl (key);


if (Bkey.length &gt;) bkey = Core_md5 (Bkey, key.length * this.chrsz);





var ipad = array, Opad = Array (16);


for (var i = 0; i &lt; i++)


{


Ipad[i] = bkey[i] ^ 0x36363636;


Opad[i] = bkey[i] ^ 0x5c5c5c5c;


}





var hash = core_md5 (str2binl (data), Ipad.concat + data.length * this.chrsz);


Return Core_md5 (Opad.concat (hash), 512 + 128);


},





CORE_MD5:


function (x, len) {


/* Append padding * *


X[len &gt;&gt; 5] |= 0x80 &lt;&lt; ((len)% 32);


X[((len +) &gt;&gt;&gt; 9) &lt;&lt; 4) + [] = Len;





var a = 1732584193;


var b =-271733879;


var c =-1732584194;


var d = 271733878;





for (var i = 0; i &lt; x.length i + + 16)


{


var Olda = A;


var oldb = b;


var oldc = c;


var oldd = D;





A = This.md5_ff (A, B, C, D, x[i+ 0], 7,-680876936);


D = this.md5_ff (d, a, B, C, x[i+ 1], 12,-389564586);


c = This.md5_ff (c, D, a, B, x[i+ 2], 17, 606105819);


b = This.md5_ff (b, C, D, A, x[i+ 3], 22,-1044525330);


A = This.md5_ff (A, B, C, D, x[i+ 4], 7,-176418897);


D = this.md5_ff (d, a, B, C, x[i+ 5], 12, 1200080426);


c = This.md5_ff (c, D, a, B, x[i+ 6], 17,-1473231341);


b = This.md5_ff (b, C, D, A, x[i+ 7], 22,-45705983);


A = This.md5_ff (A, B, C, D, x[i+ 8], 7, 1770035416);


D = this.md5_ff (d, a, B, C, x[i+ 9], 12,-1958414417);


c = This.md5_ff (c, D, a, B, x[i+10], 17,-42063);


b = This.md5_ff (b, C, D, A, x[i+11], 22,-1990404162);


A = This.md5_ff (A, B, C, D, X[i+12], 7, 1804603682);


D = this.md5_ff (d, a, B, C, x[i+13], 12,-40341101);


c = This.md5_ff (c, D, a, B, x[i+14], 17,-1502002290);


b = This.md5_ff (b, C, D, A, x[i+15], 22, 1236535329);





A = This.md5_gg (A, B, C, D, x[i+ 1], 5,-165796510);


D = This.md5_gg (d, a, B, C, x[i+ 6], 9,-1069501632);


c = This.md5_gg (c, D, a, B, x[i+11], 14, 643717713);


b = This.md5_gg (b, C, D, A, x[i+ 0], 20,-373897302);


A = This.md5_gg (A, B, C, D, x[i+ 5], 5,-701558691);


D = This.md5_gg (d, a, B, C, x[i+10], 9, 38016083);


c = This.md5_gg (c, D, a, B, x[i+15], 14,-660478335);


b = This.md5_gg (b, C, D, A, x[i+ 4], 20,-405537848);


A = This.md5_gg (A, B, C, D, x[i+ 9], 5, 568446438);


D = This.md5_gg (d, a, B, C, x[i+14], 9,-1019803690);


c = This.md5_gg (c, D, a, B, x[i+ 3], 14,-187363961);


b = This.md5_gg (b, C, D, A, x[i+ 8], 20, 1163531501);


A = This.md5_gg (A, B, C, D, X[i+13], 5,-1444681467);


D = This.md5_gg (d, a, B, C, x[i+ 2], 9,-51403784);


c = This.md5_gg (c, D, a, B, x[i+ 7], 14, 1735328473);


b = This.md5_gg (b, C, D, A, x[i+12], 20,-1926607734);





A = This.md5_hh (A, B, C, D, x[i+ 5], 4,-378558);


D = this.md5_hh (d, a, B, C, x[i+ 8], 11,-2022574463);


c = This.md5_hh (c, D, a, B, x[i+11], 16, 1839030562);


b = this.md5_hh (b, C, D, A, x[i+14], 23,-35309556);


A = This.md5_hh (A, B, C, D, x[i+ 1], 4,-1530992060);


D = this.md5_hh (d, a, B, C, x[i+ 4], 11, 1272893353);


c = This.md5_hh (c, D, a, B, x[i+ 7], 16,-155497632);


b = this.md5_hh (b, C, D, A, x[i+10], 23,-1094730640);


A = This.md5_hh (A, B, C, D, X[i+13], 4, 681279174);


D = this.md5_hh (d, a, B, C, x[i+ 0], 11,-358537222);


c = This.md5_hh (c, D, a, B, x[i+ 3], 16,-722521979);


b = this.md5_hh (b, C, D, A, x[i+ 6], 23, 76029189);


A = This.md5_hh (A, B, C, D, x[i+ 9], 4,-640364487);


D = this.md5_hh (d, a, B, C, x[i+12], 11,-421815835);


c = This.md5_hh (c, D, a, B, x[i+15], 16, 530742520);


b = this.md5_hh (b, C, D, A, x[i+ 2], 23,-995338651);





A = This.md5_ii (A, B, C, D, x[i+ 0], 6,-198630844);


D = This.md5_ii (d, a, B, C, x[i+ 7], 10, 1126891415);


c = This.md5_ii (c, D, a, B, x[i+14], 15,-1416354905);


b = This.md5_ii (b, C, D, A, x[i+ 5], 21,-57434055);


A = This.md5_ii (A, B, C, D, X[i+12], 6, 1700485571);


D = This.md5_ii (d, a, B, C, x[i+ 3], 10,-1894986606);


c = This.md5_ii (c, D, a, B, x[i+10], 15,-1051523);


b = This.md5_ii (b, C, D, A, x[i+ 1], 21,-2054922799);


A = This.md5_ii (A, B, C, D, x[i+ 8], 6, 1873313359);


D = This.md5_ii (d, a, B, C, x[i+15], 10,-30611744);


c = This.md5_ii (c, D, a, B, x[i+ 6], 15,-1560198380);


b = This.md5_ii (b, C, D, A, x[i+13], 21, 1309151649);


A = This.md5_ii (A, B, C, D, x[i+ 4], 6,-145523070);


D = This.md5_ii (d, a, B, C, x[i+11], 10,-1120210379);


c = This.md5_ii (c, D, a, B, x[i+ 2], 15, 718787259);


b = This.md5_ii (b, C, D, A, x[i+ 9], 21,-343485551);





A = This.safe_add (A, Olda);


b = This.safe_add (b, oldb);


c = This.safe_add (c, OLDC);


D = This.safe_add (d, OLDD);


}


Return Array (A, B, C, D);


},





Hex_hmac_md5:function (key, data) {return This.binl2hex (THIS.CORE_HMAC_MD5 (key, data));





Hex_md5:function (s) {return This.binl2hex (THIS.CORE_MD5 (This.str2binl (s), s.length * This.chrsz));





Md5:function (s) {return (THIS.HEX_MD5 (s));},

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);

Md5_ff:function (A, B, C, D, X, S, t) {return this.md5_cmn (b & c) | ((~b) & D), A, B, X, S, T);

Md5_gg:function (A, B, C, D, X, S, t) {return THIS.MD5_CMN (b & D) | (C & (~d)), A, B, X, S, T);

Md5_hh:function (A, B, C, D, X, S, t) {return this.md5_cmn (b ^ C ^ D, a, B, X, S, t);},

Md5_ii:function (A, B, C, D, X, S, t) {return this.md5_cmn (c ^ B | (~d)), A, B, X, S, T);

Md5_vm_test:function () {return HEX_MD5 ("abc") = = "900150983cd24fb0d6963f7d28e17f72";},

Safe_add:
function (x, y) {
var LSW = (x & 0xFFFF) + (Y & 0xFFFF);
var MSW = (x >>) + (y >>) + (LSW >> 16);
Return (MSW << 16) | (LSW & 0xFFFF);
},

STR2BINL:
function (str) {
var bin = Array ();
var mask = (1 << this.chrsz)-1;
for (var i = 0; i < str.length * This.chrsz i + = This.chrsz)
BIN[I>>5] |= (Str.charcodeat (I/this.chrsz) & Mask) << (i%32);
return bin;
},

Str_hmac_md5:function (key, data) {return binl2str (CORE_HMAC_MD5 (key, data));

Str_md5:function (s) {return binl2str (CORE_MD5 (Str2binl (s), s.length * This.chrsz));
}
</script>
<body>
<b>Source:</b><br>
<textarea id=t1></textarea><br>
<b>password:</b><input type=password value=default id=p1><input type=button onclick= "WebEncode (); "Value=" "Start Encode" ><br>
<b>Encoded:</b><br>
<textarea id=t2></textarea><br>
<input Type=button onclick= "RunCode ();" Value= "Run Code" >
</body>

Save this source code as an HTML-formatted file, and double-click to run to see the effect

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.