求键盘的所有按键对应的JS函数~~~!!!!或者提供网页键盘源代码!!

求键盘的所有按键对应的JS函数~~~!!!!或者提供网页键盘源代码!!,第1张

给你一个java aes加密解密的类吧

import javaxcrypto;

import javaxcryptospec;

public class AES {

public static String Decrypt(String sSrc, String sKey){

try {

//判断Key是否正确

if (sKey == null) {

return null;

}

//判断Key是否为16位

if (sKeylength() != 16) {

throw new Exception("解密key长度不足。");

}

byte[] raw = sKeygetBytes("ASCII");

SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES");

Cipher cipher = CiphergetInstance("AES");

cipherinit(CipherDECRYPT_MODE, skeySpec);

byte[] encrypted1 = hex2byte(sSrc);

try {

byte[] original = cipherdoFinal(encrypted1);

String originalString = new String(original);

return originalString;

} catch (Exception e) {

throw e;

}

} catch (Exception ex) {

throw ex;

}

}

//判断Key是否正确

public static String Encrypt(String sSrc, String sKey){

if (sKey == null) {

return null;

}

//判断Key是否为16位

if (sKeylength() != 16) {

throw new Exception("加密key长度不足。");

}

byte[] raw = sKeygetBytes("ASCII");

SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES");

Cipher cipher = CiphergetInstance("AES");

cipherinit(CipherENCRYPT_MODE, skeySpec);

byte[] encrypted = cipherdoFinal(sSrcgetBytes());

return byte2hex(encrypted)toLowerCase();

}

public static byte[] hex2byte(String strhex) {

if (strhex == null) {

return null;

}

int l = strhexlength();

if (l % 2 == 1) {

return null;

}

byte[] b = new byte[l / 2];

for (int i = 0; i != l / 2; i++) {

b[i] = (byte) IntegerparseInt(strhexsubstring(i 2, i 2 + 2), 16);

}

return b;

}

public static String byte2hex(byte[] b) {

String hs = "";

String stmp = "";

for (int n = 0; n < blength; n++) {

stmp = (javalangIntegertoHexString(b[n] & 0XFF));

if (stmplength() == 1) {

hs = hs + "0" + stmp;

} else {

hs = hs + stmp;

}

}

return hstoUpperCase();

}

}

以上就是关于求键盘的所有按键对应的JS函数~~~!!!!或者提供网页键盘源代码!!全部的内容,包括:求键盘的所有按键对应的JS函数~~~!!!!或者提供网页键盘源代码!!、解腾讯skey得gtk、有一个JS文件实现aes加密 想要一份和这个js一样的JAVA有高手可以帮下吗等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/9483182.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-04-28
下一篇2023-04-28

发表评论

登录后才能评论

评论列表(0条)

    保存