/*!
* Des加密解密
* 加密:DesUtils.encode('admin', '1,2,3')
* 解密:DesUtils.decode('012C2C9BA925FAF8045B2FD9B02A2664', '1,2,3')
* 表单提前加密:
*
* $('#inputForm').submit(function(){
* $('#password').val(DesUtils.encode($('#password').val(), '1,2,3'));
* });
* @author ThinkGem
*/
(function(){this.DesUtils=function(){};this.DesUtils.encode=function(z,y){if(z&&y){var A=y.split(",");if(A.length>=3){return d(z,A[0],A[1],A[2])}return d(z,y,"","")}return""},this.DesUtils.decode=function(z,y){if(z&&y){var A=y.split(",");if(A.length>=3){return h(z,A[0],A[1],A[2])}return h(z,y,"","")}return""};function d(W,P,A,D){var G=W.length;var H="";var T,Q,N,X,F,I;if(P!=null&&P!=""){T=o(P);X=T.length}if(A!=null&&A!=""){Q=o(A);F=Q.length}if(D!=null&&D!=""){N=o(D);I=N.length}if(G>0){if(G<4){var U=a(W);var E;if(P!=null&&P!=""&&A!=null&&A!=""&&D!=null&&D!=""){var S;var L,K,J;S=U;for(L=0;L0){var B=W.substring(O*4+0,G);var V=a(B);var E;if(P!=null&&P!=""&&A!=null&&A!=""&&D!=null&&D!=""){var S;var L,K,J;S=V;for(L=0;L=0;K--){R=l(R,L[K])}for(J=D-1;J>=0;J--){R=l(R,Q[J])}for(I=W-1;I>=0;I--){R=l(R,T[I])}M=R}else{if(O!=null&&O!=""&&A!=null&&A!=""){var R;var K,J,I;R=U;for(K=D-1;K>=0;K--){R=l(R,Q[K])}for(J=W-1;J>=0;J--){R=l(R,T[J])}M=R}else{if(O!=null&&O!=""){var R;var K,J,I;R=U;for(K=W-1;K>=0;K--){R=l(R,T[K])}M=R}}}F+=s(M)}return F}function o(B){var y=new Array();var A=B.length;var C=parseInt(A/4);var D=A%4;var z=0;for(z=0;z0){y[z]=a(B.substring(z*4+0,A))}return y}function a(G){var y=G.length;var H=new Array(64);if(y<4){var E=0,D=0,A=0,z=0;for(E=0;ED;B--){F*=2}H[16*E+D]=parseInt(C/F)%2}}for(A=y;A<4;A++){var C=0;for(z=0;z<16;z++){var F=1,B=0;for(B=15;B>z;B--){F*=2}H[16*A+z]=parseInt(C/F)%2}}}else{for(E=0;E<4;E++){var C=G.charCodeAt(E);for(D=0;D<16;D++){var F=1;for(B=15;B>D;B--){F*=2}H[16*E+D]=parseInt(C/F)%2}}}return H}function b(z){var y;switch(z){case"0000":y="0";break;case"0001":y="1";break;case"0010":y="2";break;case"0011":y="3";break;case"0100":y="4";break;case"0101":y="5";break;case"0110":y="6";break;case"0111":y="7";break;case"1000":y="8";break;case"1001":y="9";break;case"1010":y="A";break;case"1011":y="B";break;case"1100":y="C";break;case"1101":y="D";break;case"1110":y="E";break;case"1111":y="F";break}return y}function g(y){var z;switch(y){case"0":z="0000";break;case"1":z="0001";break;case"2":z="0010";break;case"3":z="0011";break;case"4":z="0100";break;case"5":z="0101";break;case"6":z="0110";break;case"7":z="0111";break;case"8":z="1000";break;case"9":z="1001";break;case"A":z="1010";break;case"B":z="1011";break;case"C":z="1100";break;case"D":z="1101";break;case"E":z="1110";break;case"F":z="1111";break}return z}function s(B){var A="";for(i=0;i<4;i++){var z=0;for(j=0;j<16;j++){var y=1;for(m=15;m>j;m--){y*=2}z+=B[16*i+j]*y}if(z!=0){A+=String.fromCharCode(z)}}return A}function f(A){var z="";for(i=0;i<16;i++){var y="";for(j=0;j<4;j++){y+=A[i*4+j]}z+=b(y)}return z}function c(y){var z="";for(i=0;i<16;i++){z+=g(y.substring(i,i+1))}return z}function e(z,J){var M=t(J);var I=w(z);var A=new Array(32);var L=new Array(32);var E=new Array(32);var H=0,G=0,F=0,D=0,C=0;for(F=0;F<32;F++){A[F]=I[F];L[F]=I[32+F]}for(H=0;H<16;H++){for(G=0;G<32;G++){E[G]=A[G];A[G]=L[G]}var K=new Array(48);for(D=0;D<48;D++){K[D]=M[H][D]}var y=r(q(p(r(u(L),K))),E);for(C=0;C<32;C++){L[C]=y[C]}}var B=new Array(64);for(H=0;H<32;H++){B[H]=L[H];B[32+H]=A[H]}return v(B)}function l(z,J){var M=t(J);var I=w(z);var A=new Array(32);var L=new Array(32);var E=new Array(32);var H=0,G=0,F=0,D=0,C=0;for(F=0;F<32;F++){A[F]=I[F];L[F]=I[32+F]}for(H=15;H>=0;H--){for(G=0;G<32;G++){E[G]=A[G];A[G]=L[G]}var K=new Array(48);for(D=0;D<48;D++){K[D]=M[H][D]}var y=r(q(p(r(u(L),K))),E);for(C=0;C<32;C++){L[C]=y[C]}}var B=new Array(64);for(H=0;H<32;H++){B[H]=L[H];B[32+H]=A[H]}return v(B)}function w(z){var y=new Array(64);for(i=0,m=1,n=0;i<4;i++,m+=2,n+=2){for(j=7,k=0;j>=0;j--,k++){y[i*8+k]=z[j*8+m];y[i*8+k+32]=z[j*8+n]}}return y}function u(y){var z=new Array(48);for(i=0;i<8;i++){if(i==0){z[i*6+0]=y[31]}else{z[i*6+0]=y[i*4-1]}z[i*6+1]=y[i*4+0];z[i*6+2]=y[i*4+1];z[i*6+3]=y[i*4+2];z[i*6+4]=y[i*4+3];if(i==7){z[i*6+5]=y[0]}else{z[i*6+5]=y[i*4+4]}}return z}function r(A,z){var y=new Array(A.length);for(i=0;i