网站建设资讯

NEWS

网站建设资讯

jquerymd5,jquery md5加密

jQuery有一款这样的MD5加密插件

像你说的这种加密插件还有一个叫BASE64, 一般是用来对客户端数据加密后发送给服务器,或对服务器端返回的数据进行解密显示给用户。

创新互联建站专注于企业营销型网站建设、网站重做改版、邻水网站定制设计、自适应品牌网站建设、HTML5建站商城网站建设、集团公司官网建设、外贸营销网站建设、高端网站制作、响应式网页设计等建站业务,价格优惠性价比高,为邻水等各大城市提供网站开发制作服务。

加密后的数据对一般人来说是不可以读的,比如:

加密前:THIS IS A TEST

加密后(MD5):

(32位)4F00F293709E82E3359238ECDA10A740

(16位)709E82E3359238EC

一般这种加密插件,一般都会有解密功能的,并且会跟服务器端的加密解密保持一致。

希望能对你理解加密插件有帮助!

易语言怎么调用jQuery.MD5算法

2种语言不相通,易语言也有自己的md5写法吧,或者提供对应的算法吧,不能调用,只能模拟jQuery.md5 的算法。

用jQuery.md5.js加密密码后后台怎么解密?

MD5不是加密算法,它是Hash算法,所以它不可逆,也没法还原成原文。

你可以用base64、异或或者aes des等加密算法去实现。

1、base64加密

在页面中引入base64.js文件,调用方法为:

?

123456789101112131415161718

!DOCTYPE HTMLhtmlheadmeta charset="utf-8"titlebase64加密/titlescript type="text/javascript" src="base64.js"/scriptscript type="text/javascript"  var b = new Base64();  var str = b.encode("admin:admin");  alert("base64 encode:" + str);//解密  str = b.decode(str);  alert("base64 decode:" + str);/script/headbody/body/html

2、md5加密

在页面中引用md5.js文件,调用方法为

?

1234567891011121314

!DOCTYPE HTMLhtmlheadmeta charset="utf-8"titlemd5加密/titlescript type="text/ecmascript" src="md5.js"/scriptscript type="text/javascript" var hash = hex_md5("123dafd"); alert(hash)/script/headbody/body/html

3、sha1加密

据说这是最安全的加密

页面中引入sha1.js,调用方法为

?

1234567891011121314

!DOCTYPE HTMLhtmlheadmeta charset="utf-8"titlesha1加密/titlescript type="text/ecmascript" src="sha1.js"/scriptscript type="text/javascript" var sha = hex_sha1('mima123465') alert(sha)/script/headbody/body/html

一下为js们的源代码

base64.js:

?

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106

/**** Base64 encode / decode** @author haitao.tu* @date 2010-04-26* @email tuhaitao@foxmail.com**/function Base64() { // private property _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; // 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 input.length) {   chr1 = input.charCodeAt(i++);   chr2 = input.charCodeAt(i++);   chr3 = input.charCodeAt(i++);   enc1 = chr1 2;   enc2 = ((chr1 3) 4) | (chr2 4);   enc3 = ((chr2 15) 2) | (chr3 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) + _keyStr.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 input.length) {   enc1 = _keyStr.indexOf(input.charAt(i++));   enc2 = _keyStr.indexOf(input.charAt(i++));   enc3 = _keyStr.indexOf(input.charAt(i++));   enc4 = _keyStr.indexOf(input.charAt(i++));   chr1 = (enc1 2) | (enc2 4);   chr2 = ((enc2 15) 4) | (enc3 2);   chr3 = ((enc3 3) 6) | enc4;   output = output + String.fromCharCode(chr1);   if (enc3 != 64) {    output = output + String.fromCharCode(chr2);   }   if (enc4 != 64) {    output = output + String.fromCharCode(chr3);   }  }  output = _utf8_decode(output);  return output; } // private method for UTF-8 encoding _utf8_encode = function (string) {  string = string.replace(/\r\n/g,"\n");  var utftext = "";  for (var n = 0; n string.length; n++) {   var c = string.charCodeAt(n);   if (c 128) {    utftext += String.fromCharCode(c);   } else if((c 127) (c 2048)) {    utftext += String.fromCharCode((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; } // private method for UTF-8 decoding _utf8_decode = function (utftext) {  var string = "";  var i = 0;  var c = c1 = c2 = 0;  while ( i utftext.length ) {   c = utftext.charCodeAt(i);   if (c 128) {    string += String.fromCharCode(c);    i++;   } else if((c 191) (c 224)) {    c2 = utftext.charCodeAt(i+1);    string += String.fromCharCode(((c 31) 6) | (c2 63));    i += 2;   } else {    c2 = utftext.charCodeAt(i+1);    c3 = utftext.charCodeAt(i+2);    string += String.fromCharCode(((c 15) 12) | ((c2 63) 6) | (c3 63));    i += 3;   }  }  return string; }}

jquery.md5.js java md5不一致,求解

因为Java默认编码是unicode, byte[] btInput = s.getBytes();获得的是默认的unicode的byte数组。需要将这句改为byte[] btInput = s.getBytes("utf-8");就OK啦。

Jquery与java MD5加密不同

var hexcase=0;

function encryptToMD5(a){ if(a=="") return a; return rstr2hex(rstr_md5(str2rstr_utf8(a)))}function hex_hmac_md5(a,b){return rstr2hex(rstr_hmac_md5(str2rstr_utf8(a),str2rstr_utf8(b)))}function md5_vm_test(){return hex_md5("abc").toLowerCase()=="900150983cd24fb0d6963f7d28e17f72"}function rstr_md5(a){return binl2rstr(binl_md5(rstr2binl(a),a.length*8))}function rstr_hmac_md5(c,f){var e=rstr2binl(c);if(e.length16){e=binl_md5(e,c.length*8)}var a=Array(16),d=Array(16);for(var b=0;b16;b++){a[b]=e[b]^909522486;d[b]=e[b]^1549556828}var g=binl_md5(a.concat(rstr2binl(f)),512+f.length*8);return binl2rstr(binl_md5(d.concat(g),512+128))}function rstr2hex(c){try{hexcase}catch(g){hexcase=0}var f=hexcase?"0123456789ABCDEF":"0123456789abcdef";var b="";var a;for(var d=0;dc.length;d++){a=c.charCodeAt(d);b+=f.charAt((a4)15)+f.charAt(a15)}return b}function str2rstr_utf8(c){var b="";var d=-1;var a,e;while(++dc.length){a=c.charCodeAt(d);e=d+1c.length?c.charCodeAt(d+1):0;if(55296=aa=5631956320=ee=57343){a=65536+((a1023)10)+(e1023);d++}if(a=127){b+=String.fromCharCode(a)}else{if(a=2047){b+=String.fromCharCode(192|((a6)31),128|(a63))}else{if(a=65535){b+=String.fromCharCode(224|((a12)15),128|((a6)63),128|(a63))}else{if(a=2097151){b+=String.fromCharCode(240|((a18)7),128|((a12)63),128|((a6)63),128|(a63))}}}}}return b}function rstr2binl(b){var a=Array(b.length2);for(var c=0;ca.length;c++){a[c]=0}for(var c=0;cb.length*8;c+=8){a[c5]|=(b.charCodeAt(c/8)255)(c%32)}return a}function binl2rstr(b){var a="";for(var c=0;cb.length*32;c+=8){a+=String.fromCharCode((b[c5](c%32))255)}return a}function binl_md5(p,k){p[k5]|=128((k)%32);p[(((k+64)9)4)+14]=k;var o=1732584193;var n=-271733879;var m=-1732584194;var l=271733878;for(var g=0;gp.length;g+=16){var j=o;var h=n;var f=m;var e=l;o=md5_ff(o,n,m,l,p[g+0],7,-680876936);l=md5_ff(l,o,n,m,p[g+1],12,-389564586);m=md5_ff(m,l,o,n,p[g+2],17,606105819);n=md5_ff(n,m,l,o,p[g+3],22,-1044525330);o=md5_ff(o,n,m,l,p[g+4],7,-176418897);l=md5_ff(l,o,n,m,p[g+5],12,1200080426);m=md5_ff(m,l,o,n,p[g+6],17,-1473231341);n=md5_ff(n,m,l,o,p[g+7],22,-45705983);o=md5_ff(o,n,m,l,p[g+8],7,1770035416);l=md5_ff(l,o,n,m,p[g+9],12,-1958414417);m=md5_ff(m,l,o,n,p[g+10],17,-42063);n=md5_ff(n,m,l,o,p[g+11],22,-1990404162);o=md5_ff(o,n,m,l,p[g+12],7,1804603682);l=md5_ff(l,o,n,m,p[g+13],12,-40341101);m=md5_ff(m,l,o,n,p[g+14],17,-1502002290);n=md5_ff(n,m,l,o,p[g+15],22,1236535329);o=md5_gg(o,n,m,l,p[g+1],5,-165796510);l=md5_gg(l,o,n,m,p[g+6],9,-1069501632);m=md5_gg(m,l,o,n,p[g+11],14,643717713);n=md5_gg(n,m,l,o,p[g+0],20,-373897302);o=md5_gg(o,n,m,l,p[g+5],5,-701558691);l=md5_gg(l,o,n,m,p[g+10],9,38016083);m=md5_gg(m,l,o,n,p[g+15],14,-660478335);n=md5_gg(n,m,l,o,p[g+4],20,-405537848);o=md5_gg(o,n,m,l,p[g+9],5,568446438);l=md5_gg(l,o,n,m,p[g+14],9,-1019803690);m=md5_gg(m,l,o,n,p[g+3],14,-187363961);n=md5_gg(n,m,l,o,p[g+8],20,1163531501);o=md5_gg(o,n,m,l,p[g+13],5,-1444681467);l=md5_gg(l,o,n,m,p[g+2],9,-51403784);m=md5_gg(m,l,o,n,p[g+7],14,1735328473);n=md5_gg(n,m,l,o,p[g+12],20,-1926607734);o=md5_hh(o,n,m,l,p[g+5],4,-378558);l=md5_hh(l,o,n,m,p[g+8],11,-2022574463);m=md5_hh(m,l,o,n,p[g+11],16,1839030562);n=md5_hh(n,m,l,o,p[g+14],23,-35309556);o=md5_hh(o,n,m,l,p[g+1],4,-1530992060);l=md5_hh(l,o,n,m,p[g+4],11,1272893353);m=md5_hh(m,l,o,n,p[g+7],16,-155497632);n=md5_hh(n,m,l,o,p[g+10],23,-1094730640);o=md5_hh(o,n,m,l,p[g+13],4,681279174);l=md5_hh(l,o,n,m,p[g+0],11,-358537222);m=md5_hh(m,l,o,n,p[g+3],16,-722521979);n=md5_hh(n,m,l,o,p[g+6],23,76029189);o=md5_hh(o,n,m,l,p[g+9],4,-640364487);l=md5_hh(l,o,n,m,p[g+12],11,-421815835);m=md5_hh(m,l,o,n,p[g+15],16,530742520);n=md5_hh(n,m,l,o,p[g+2],23,-995338651);o=md5_ii(o,n,m,l,p[g+0],6,-198630844);l=md5_ii(l,o,n,m,p[g+7],10,1126891415);m=md5_ii(m,l,o,n,p[g+14],15,-1416354905);n=md5_ii(n,m,l,o,p[g+5],21,-57434055);o=md5_ii(o,n,m,l,p[g+12],6,1700485571);l=md5_ii(l,o,n,m,p[g+3],10,-1894986606);m=md5_ii(m,l,o,n,p[g+10],15,-1051523);n=md5_ii(n,m,l,o,p[g+1],21,-2054922799);o=md5_ii(o,n,m,l,p[g+8],6,1873313359);l=md5_ii(l,o,n,m,p[g+15],10,-30611744);m=md5_ii(m,l,o,n,p[g+6],15,-1560198380);n=md5_ii(n,m,l,o,p[g+13],21,1309151649);o=md5_ii(o,n,m,l,p[g+4],6,-145523070);l=md5_ii(l,o,n,m,p[g+11],10,-1120210379);m=md5_ii(m,l,o,n,p[g+2],15,718787259);n=md5_ii(n,m,l,o,p[g+9],21,-343485551);o=safe_add(o,j);n=safe_add(n,h);m=safe_add(m,f);l=safe_add(l,e)}return Array(o,n,m,l)}function md5_cmn(h,e,d,c,g,f){return safe_add(bit_rol(safe_add(safe_add(e,h),safe_add(c,f)),g),d)}function md5_ff(g,f,k,j,e,i,h){return md5_cmn((fk)|((~f)j),g,f,e,i,h)}function md5_gg(g,f,k,j,e,i,h){return md5_cmn((fj)|(k(~j)),g,f,e,i,h)}function md5_hh(g,f,k,j,e,i,h){return md5_cmn(f^k^j,g,f,e,i,h)}function md5_ii(g,f,k,j,e,i,h){return md5_cmn(k^(f|(~j)),g,f,e,i,h)}function safe_add(a,d){var c=(a65535)+(d65535);var b=(a16)+(d16)+(c16);return(b16)|(c65535)}function bit_rol(a,b){return(ab)|(a(32-b))};

这是javascript的md5算法,测试过跟java的MD5加出来是一样的

使用方法:

var md5Pwd = encryptToMD5(str);

md5-min.js或jquery.min.js文件被破坏,请问出现要怎么处理

这个文件使用了美元符号,和JQUERY冲突了,给你几个解决方法:

先加载JQUERY,然后使用语句 jQuery.noConflict();

再加载其他JS文件,后面在使用jQuery时都换下,如:$('#div') 换成 jQuery('#div'),

如果嫌jQuery太长可以 $j = jQuery; $j('#div')

script src="jquery.js"/script

script

jQuery.noConflict();

/script

script src="其他.js"/script


本文题目:jquerymd5,jquery md5加密
本文路径:http://cdweb.net/article/dsspiss.html