前臺js加密實例

1.base64加密jquery

 

一個字節通常由8位表示,base64加密就是把8位表示轉爲6爲表示,餘下2位添0表示,故有個特色不能充分利用空間。安全

資源下載:jquery.js,base64.js編碼

// `utf8encode` - utf8 encoding only (default: `false`)
        // `utf8decode` - utf8 decoding only (default: `false`)
        // `raw` - both (default: `true`)
        $.base64.utf8encode = true;
        //編碼
        var str = $.base64.encode("a");
        alert("base64 decode:" + str);
        //解碼
        str = $.base64.decode(str);
        alert("base64 decode:" + str);

 

2.md5加密加密

 

md5加密是一種不可逆的加密方式,spa

資源下載:jquery.js,md5.jscode

var str = $.md5("a");
        alert(str);

 

3.sha1加密blog

 

sha1加密方式也是一種不可逆的加密方式,相對來說要比較安全些。md5

資源下載:jquery.js,sha1.js資源

var str = $.sha1("a");
        alert(str);
相關文章
相關標籤/搜索