/* @desc Base64 encoder and decoder write by JavaScript. This code was a plugin of jQeury, you must load jQuery library first if you want to use this code. - After encode, you can decode it with PHP, and vice versa - Support Unicode library This code was collected from the network, I just rewrite it as the plugin of jQuery, the copyright belongs to original work(s). @Version 1.0 build 20080908 @Author Hpyer @Home http://www.hpyer.cn/jquery-plugin-base64-encode-and-decode.html @Usage Whether or not to use UNICODE library: $.base64.is_unicode = false/true; Encode: $.base64.encode('$.base64'); Decode: $.base64.decode('JC5iYXNlNjQ='); @License Free */ jQuery.base64={is_unicode:false,encode:function(C){if(this.is_unicode){C=this._u2a(C)}var A="";var J,H,F="";var I,G,E,D="";var B=0;do{J=C.charCodeAt(B++);H=C.charCodeAt(B++);F=C.charCodeAt(B++);I=J>>2;G=((J&3)<<4)|(H>>4);E=((H&15)<<2)|(F>>6);D=F&63;if(isNaN(H)){E=D=64}else{if(isNaN(F)){D=64}}A=A+this._keys.charAt(I)+this._keys.charAt(G)+this._keys.charAt(E)+this._keys.charAt(D);J=H=F="";I=G=E=D=""}while(B>4);I=((H&15)<<4)|(F>>2);G=((F&3)<<6)|E;B=B+String.fromCharCode(K);if(F!=64){B+=String.fromCharCode(I)}if(E!=64){B+=String.fromCharCode(G)}K=I=G="";J=H=F=E=""}while(C127){F=this._u2a_char(F)}if(F>255){var B=F&65280;B=B>>8;var E=F&255;A+=String.fromCharCode(B)+String.fromCharCode(E)}else{A+=String.fromCharCode(F)}}return A},_a2u:function(E){var B=E.length;var A="";var F;for(var C=0;C127){F=this._a2u_char((D<<8)+E.charCodeAt(++C))}else{F=D}A+=String.fromCharCode(F)}return A}};