• long8娱乐_long8娱乐官网》》》

  • 发布时间:2016-01-15 14:41 | 作者:yc | 来源:互联网 | 浏览:1200 次
  • long8娱乐_long8娱乐官网》》》

    js-base64加密实例:

    base64,js

    /**

    *

    *Base64 encode / decode

    *

    *@author

    *@date2010-04-26

    *@email

    *

    */

    function Base64() {

    // private property

    _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+/=";

    // public method for encoding

    this.encode = function (input) {

    var output = "";

    var chr1, chr2, chr3, enc1, enc2, enc3, enc4;

    var i = 0;

    input = _utf8_encode(input);

    while (i > 2;

    enc2 = ((chr1 & 3) > 4);

    enc3 = ((chr2 & 15) > 6);

    enc4 = chr3 & 63;

    if (isNaN(chr2)) {

    enc3 = enc4 = 64;

    } else if (isNaN(chr3)) {

    enc4 = 64;

    }

    output = output +

    _keyStr.charAt(enc1) + _keyStr.charAt(enc2) +

    _keyStr.charAt(enc3) + _keylong8娱乐_long8娱乐官网》》》617888.netStr.charAt(enc4);

    }

    return output;

    }

    // public method for decoding

    this.decode = function (input) {

    var output = "";

    var chr1, chr2, chr3;

    var enc1, enc2, enc3, enc4;

    var i = 0;

    input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");

    while (i > 4);

    chr2 = ((enc2 & 15) > 2);

    chr3 = ((enc3 & 3)127) && (c > 6) | 192);

    utftext += String.fromCharCode((c & 63) | 128);

    } else {

    utftext += String.fromCharCode((c >> 12) | 224);

    utftext += String.fromCharCode(((c >> 6) & 63) | 128);

    utftext += String.fromCharCode((c & 63) | 128);

    }

    }

    return utftext;

    }

    long8娱乐_long8娱乐官网》》》

    // private method for UTF-8 decoding

    _utf8_decode = function (utftext) {

    var 108mg.comstring = "";

    var i = 0;

    var c = c1 = c2 = 0;

    while ( i191) && (c

    650) this.width=650;" src="/html/uploads/allimg/160115/14413V323-2.jpg" title="aa.png" alt="wKiom1YfFzSgcaQpAAGfZLm3Ar4162.jpg" />

    这篇文章出自 “wennuanyiran” 博客,请必须保存此出处http://dingzhaoqiang.blog.51cto.com//

  • 相关内容

友情链接: