jquery参数加密解密
❶ jquery选择器中加变量参数
可以参考以下两种方法:
1、代码一
funciton(id){
$("#"+id).hide();
}
2、代码二
funciton(id){
$("#"+id的值).hide();//比如$("#"+myid).hide();
}
(1)jquery参数加密解密扩展阅读:
jquery选择器:
1、#id
用法: $("#myDiv"); 返回值 单个元素耐漏锋的组成的集合
说明: 这个就是直接选择html中的id="myDiv"
2、Element
用法: $("div") 返回值 集合元素
说明: element的英文翻搜和译过来是”元素”昌晌,所以element其实就是html已经定义的标签元素,例如div,input, a等等。
❷ jQuery有一款这样的MD5加密插件
像你说的这种加密插件还有一个叫BASE64, 一般是用来对客户端数据加密后发送给服务器,或对服务器端返回的数据进行解密显示给用户。
加密后的数据对一般人来说是不可以读的,比如:
加密前:THIS IS A TEST
加密后(MD5):
(32位)
(16位)709E82E3359238EC
一般这种加密插件,一般都会有解密功能的,并且会跟服务器端的加密解密保持一致。
希望能对你理解加密插件有帮助!
❸ 如何修改form表单中的input值并加密
按下提交按钮---jquery获取输入框的值------利用ajax传值到servlet-----servlet获取该值并用MD5加密------保存数据
MD5加密方式不能解密。注意了。
❹ jquery ajax 统一对参数进行base64编码
ajax提交之前
以JQuery为例
var options = {
target: '', // target element(s) to be updated with server response
// url: url,
beforeSubmit: showRequest, // pre-submit callback
success: showResponse // post-submit callback
};
有个 beforeSubmit,对应showRequest方法,在这个方法里面可以进行加密
// pre-submit callback
function showRequest(formData, jqForm, options) {
var queryString = $.param(formData);
//可以在此进行数据加密
return true;
}
❺ jquery高手进
IE6下面一样可以PNG透明, 只是效肢宏慎果不是很好。
解码以后代码如下:
(function(m){jQuery.fn.pngFix=function(c){c=jQuery.extend({blankgif:'blank.gif'},c);var e=(navigator.appName=="Microsoft Internet Explorer"&&parseInt(navigator.appVersion)==4&&navigator.appVersion.indexOf("MSIE 5.5")!=-1);var f=(navigator.appName=="Microsoft Internet Explorer"历敬&&parseInt(navigator.appVersion)==4&&navigator.appVersion.indexOf("MSIE 6.0")!=-1);if(jQuery.browser.msie&&(e||f)){jQuery(this).find("img[src$=.png]").each(function(){jQuery(this).attr('width',jQuery(this).width());jQuery(this).attr('height',jQuery(this).height());var a='';var b='';var g=(jQuery(this).attr('id'))?'id="绝薯'+jQuery(this).attr('id')+'" ':'';var h=(jQuery(this).attr('class'))?'class="'+jQuery(this).attr('class')+'" ':'';var i=(jQuery(this).attr('title'))?'title="'+jQuery(this).attr('title')+'" ':'';var j=(jQuery(this).attr('alt'))?'alt="'+jQuery(this).attr('alt')+'" ':'';var k=(jQuery(this).attr('align'))?'float:'+jQuery(this).attr('align')+';':'';var d=(jQuery(this).parent().attr('href'))?'cursor:hand;':'';if(this.style.border){a+='border:'+this.style.border+';';this.style.border=''}if(this.style.padding){a+='padding:'+this.style.padding+';';this.style.padding=''}if(this.style.margin){a+='margin:'+this.style.margin+';';this.style.margin=''}var l=(this.style.cssText);b+='<span '+g+h+i+j;b+='style="position:relative;white-space:pre-line;display:inline-block;background:transparent;'+k+d;b+='width:'+jQuery(this).width()+'px;height:'+jQuery(this).height()+'px;';b+='filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\''+jQuery(this).attr('src')+'\', sizingMethod=\'scale\');';b+=l+'"></span>';if(a!=''){b='<span style="position:relative;display:inline-block;'+a+d+'width:'+jQuery(this).width()+'px;height:'+jQuery(this).height()+'px;">'+b+'</span>'}jQuery(this).hide();jQuery(this).after(b)});jQuery(this).find("*").each(function(){var a=jQuery(this).css('background-image');if(a.indexOf(".png")!=-1){var b=a.split('url("')[1].split('")')[0];jQuery(this).css('background-image','none');jQuery(this).get(0).runtimeStyle.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+b+"',sizingMethod='scale')"}});jQuery(this).find("input[src$=.png]").each(function(){var a=jQuery(this).attr('src');jQuery(this).get(0).runtimeStyle.filter='progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\''+a+'\', sizingMethod=\'scale\');';jQuery(this).attr('src',c.blankgif)})}return jQuery}})(jQuery);
❻ jquery中location.href方法。为什么中文字符默认被加密了,格式是decode加密一样
$.ajax的时候,把location.href用encodeURIComponent编码一下。
❼ Jquery 如何加密Post的值
URIencode();
❽ 怎么重写jquery ajax方法 加密
(function($){
//备份jquery的ajax方法
var _ajax=$.ajax;
//重写jquery的ajax方法
$.ajax=function(opt){
//备份opt中error和success方法
var fn = {
error:function(XMLHttpRequest, textStatus, errorThrown){},
success:function(data, textStatus){}
}
if(opt.error){
fn.error=opt.error;
}
if(opt.success){
fn.success=opt.success;
}
//扩展增强处理
var _opt = $.extend(opt,{
error:function(XMLHttpRequest, textStatus, errorThrown){
//错误方法增强处理
if (layer) {
layer.msg("出错了,请联系管理员!", 2, 3, null, true);
} else {
alert("出错了,请联系管理员!");
}
fn.error(XMLHttpRequest, textStatus, errorThrown);
},
success:function(data, textStatus){
//成功回调方法增强处理
var error = data.error;
if (error != undefined && error == true) {
if (layer) {
layer.msg(data.reason, 2, 3, null, true);
} else {
alert(data.reason);
}
return;
}
fn.success(data, textStatus);
}
});
_ajax(_opt);
};
})(jQuery);
❾ 这段java代码什么意思
javax.crypto.Cipher类提供加密和解密功能,该类是JCE框架的核心。
一,与所有的引擎类一样,可以通过调用Cipher类中的getInstance静态工厂方法得到Cipher对象。
public static Cipher getInstance(String transformation);
public static Cipher getInstance(String transformation,String provider);
参数transformation是一个字符串,它描述了由指定输入产生输出所进行的操作或操作集合。
参数transformation总是包含密码学算法名称,比如DES,也可以在后面包含模式和填充方式。
参数transformation可以是下列两种形式之一:
“algorithm/mode/padding”
“algorithm”
例如下面的例子就是有效的transformation形式:
"DES/CBC/PKCS5Padding"
"DES"
如 果没有指定模式或填充方式,就使用特定提供者指定的默认模式或默认填充方式。蠢陆例如,SunJCE提供者使用ECB作为DES、DES-EDE和 Blowfish等Cipher的默认模式,并使用PKCS5Padding作为它们默认的填充方案。这意味着在SunJCE提供者中,下列形式的声明是 等价的:Cipher c1=Cipher.getInstance("DES/ECB/PKCS5Padding");
Cipher c1=Cipher.getInstance("DES");
当 以流加密方式请求以块划分的cipher时,可以在模式名后面跟上一次运算需要操作的bit数目,例如采用"DES/CFB8/NoPadding"和 "DES/OFB32/PKCS5Padding"形式的transformation参数尘备。如果没有指定数目,则使用提供者指定的默认值(例如 SunJCE提供者使用的默认值是64bit)。
getInstance工厂方法返回的对象没有派档毁进行初始化,因此在使用前必须进行初始化。
通过getInstance得到的Cipher对象必须使用下列四个模式之一进行初始化,这四个模式在Cipher类中被定义为final integer常数,我们可以使用符号名来引用这些模式:
ENCRYPT_MODE,加密数据
DECRYPT_MODE,解密数据
WRAP_MODE,将一个Key封装成字节,可以用来进行安全传输
UNWRAP_MODE,将前述已封装的密钥解开成java.security.Key对象
每个Cipher初始化方法使用一个模式参数opmod,并用此模式初始化Cipher对象。此外还有其他参数,包括密钥key、包含密钥的证书certificate、算法参数params和随机源random。
我们可以调用以下的init方法之一来初始化Cipher对象:
public void init(int opmod,Key key);
public void init(int opmod,Certificate certificate);
public void init(int opmod,Key key,SecureRandom random);
public void init(int opmod,Certificate certificate,SecureRandom random);
public void init(int opmod,Key key,AlgorithmParameterSpec params);
public void init(int opmod,Key key,AlgorithmParameterSpec params,SecureRandom random);
public void init(int opmod,Key key,AlgorithmParameters params);
public void init(int opmod,Key key,AlgorithmParameters params,SecureRandom random);
必须指出的是,加密和解密必须使用相同的参数。当Cipher对象被初始化时,它将失去以前得到的所有状态。即,初始化Cipher对象与新建一个Cipher实例然后将它初始化是等价的。
二,可以调用以下的doFinal()方法之一完成单步的加密或解密数据:
public byte[] doFinal(byte[] input);
public byte[] doFinal(byte[] input,int inputOffset,int inputLen);
public int doFinal(byte[] input,int inputOffset,int inputLen,byte[] output);
public int doFinal(byte[] input,int inputOffset,int inputLen,byte[] output,int outputOffset);
在多步加密或解密数据时,首先需要一次或多次调用update方法,用以提供加密或解密的所有数据:
public byte[] update(byte[] input);
public byte[] update(byte[] input,int inputOffset,int inputLen);
public int update(byte[] input,int inputOffset,int inputLen,byte[] output);
public int update(byte[] input,int inputOffset,int inputLen,byte[] output,int outputOffset);
如果还有输入数据,多步操作可以使用前面提到的doFinal方法之一结束。如果没有数据,多步操作可以使用下面的doFinal方法之一结束:
public byte[] doFinal();
public int doFinal(byte[] output,int outputOffset);
如果在transformation参数部分指定了padding或unpadding方式,则所有的doFinal方法都要注意所用的padding或unpadding方式。
调用doFinal方法将会重置Cipher对象到使用init进行初始化时的状态,就是说,Cipher对象被重置,使得可以进行更多数据的加密或解密,至于这两种模式,可以在调用init时进行指定。
三,包裹wrap密钥必须先使用WRAP_MODE初始化Cipher对象,然后调用以下方法:
public final byte[] wrap(Key key);
如果将调用wrap方法的结果(wrap后的密钥字节)提供给解包裹unwrap的人使用,必须给接收者发送以下额外信息:
(1)密钥算法名称:
密钥算法名称可以调用Key接口提供的getAlgorithm方法得到:
public String getAlgorithm();
(2)被包裹密钥的类型(Cipher.SECRET_KEY,Cipher.PRIVATE_KEY,Cipher.PUBLIC_KEY)
sourcelink: http://bbs.s.e.cn/pc/pccon.php?id=1292&nid=41716&order=&tid=
为了对调用wrap方法返回的字节进行解包,必须先使用UNWRAP_MODE模式初始化Cipher对象,然后调用以下方法 :
public final Key unwrap(byte[] wrappedKey,String wrappedKeyAlgorithm,int wrappedKeyType));
其 中,参数wrappedKey是调用wrap方法返回的字节,参数wrappedKeyAlgorithm是用来包裹密钥的算法,参数 wrappedKeyType是被包裹密钥的类型,该类型必须是Cipher.SECRET_KEY,Cipher.PRIVATE_KEY, Cipher.PUBLIC_KEY三者之一。
四,SunJCE提供者实现的cipher算法使用如下参数:
(1)采用CBC、CFB、OFB、PCBC模式的DES、DES-EDE和Blowfish算法。,它们使用初始化向量IV作为参数。可以使用javax.crypto.spec.IvParameterSpec类并使用给定的IV参数来初始化Cipher对象。
(2)PBEWithMD5AndDES使用的参数是一个由盐值和迭代次数组成的参数集合。可以使用javax.crypto.spec.PBEParameterSpec类并利用给定盐值和迭代次数来初始化Cipher对象。
注意:如果使用SealedObject类,就不必为解密运算参数的传递和保存担心。这个类在加密对象内容中附带了密封和加密的参数,可以使用相同的参数对其进行解封和解密。
Cipher 中的某些update和doFinal方法允许调用者指定加密或解密数据的输出缓存。此时,保证指定的缓存足够大以容纳加密或解密运算的结果是非常重要 的