QQMD5封闭到C#

private string MD5(string uin, string pass, string code)
{
    //添加COM引用:Microsoft Script Control 1.0
    string MyJs = @"function MD5(uin,pass,code){var I=hexchar2bin(md5(pass));var H=md5(I+uin);var G=md5(H+code.toUpperCase());return G }var hexcase=1;var b64pad="""";va" +
    "r chrsz=8;var mode=32;function md5(A){return hex_md5(A)}function hex_md5(A){return binl2hex(core_md5(str2binl(A),A.length*chrsz))}function str_md5(A){" +
    "return binl2str(core_md5(str2binl(A),A.length*chrsz))}function hex_hmac_md5(A,B){return binl2hex(core_hmac_md5(A,B))}function b64_hmac_md5(A,B){return" +
    " binl2b64(core_hmac_md5(A,B))}function str_hmac_md5(A,B){return binl2str(core_hmac_md5(A,B))}function core_md5(K,F){ K[F>>5]|=128<<((F)% 32);K[(((F+64" +
    ")>>>9)<<4)+14]=F;var J=1732584193;var I=-271733879;var H=-1732584194;var G=271733878;for(var C=0;C16){ E=core_md5(E,C.length*chrsz)}var A=Array(16),D=Array(16);for(var B=0;B<16;B++){ A[B]=E[B]^909522486;D" +
    "[B]=E[B]^1549556828 }var G=core_md5(A.concat(str2binl(F)),512+F.length*chrsz);return core_md5(D.concat(G),512+128)}function safe_add(A,D){var C=(A&655" +
    "35)+(D&65535);var B=(A>>16)+(D>>16)+(C>>16);return (B<<16)|(C&65535)}function bit_rol(A,B){return (A<>>(32-B))}function str2binl(D){var C=Array" +
    @"();var A=(1<>5]|=(D.charCodeAt(B/chrsz)&A)<<(B % 32)}return C }function binl2str(C){var D="""";v" +
    @"ar A=(1<>5]>>>(B % 32))&A)}return D }function binl2hex(C){var B=hexcase?""0" +
    @"123456789ABCDEF"":""0123456789abcdef"";var D="""";for(var A=0;A>2]>>((A % 4)*8+4))&15)+B.charAt((C[A>>2]>>((A % 4)*" +
    @"8))&15)}return D }function binl2b64(D){var C=""ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"";var F="""";for(var B=0;B>2]>>8*(B % 4))&255)<<16)|(((D[B+1>>2]>>8*((B+1)% 4))&255)<<8)|((D[B+2>>2]>>8*((B+2)% 4))&255);for(var A=0;A<4;A++){if(B*8+A*6>D.le" +
    @"ngth*32){ F+=b64pad }else{ F+=C.charAt((E>>6*(3-A))&63)} } }return F }function hexchar2bin(str){var arr=[];for(var i=0;i




你可能感兴趣的:(C#)