Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

JAVAʵÏÖAES¼ÓÃÜ


JAVAʵÏÖAES¼ÓÃÜ
1. Òò×Ó
       ÉϴνéÉÜÁË¡¶JAVAʵÏÖAES¼ÓÃÜ¡·£¬ÖмäÌáµ½½üЩÄêDESʹÓÃÔ½À´Ô½ÉÙ£¬Ô­Òò¾ÍÔÚÓÚÆäʹÓÃ56λÃÜÔ¿£¬±È½ÏÈÝÒ×±»Æƽ⣬½üЩÄêÀ´Öð½¥±»AESÌæ´ú£¬AESÒѾ­±ä³ÉÄ¿Ç°¶Ô³Æ¼ÓÃÜÖÐ×îÁ÷ÐÐËã·¨Ö®Ò»£»AES¿ÉÒÔʹÓÃ128¡¢192¡¢ºÍ256λÃÜÔ¿£¬²¢ÇÒÓÃ128λ·Ö×é¼ÓÃܺͽâÃÜÊý¾Ý¡£±¾Îľͼòµ¥½éÉÜÈçºÎͨ¹ýJAVAʵÏÖAES¼ÓÃÜ¡£
2. JAVAʵÏÖ
Ïл°ÉÙÐí£¬ÂÓ¹ýAES¼ÓÃÜÔ­Àí¼°Ëã·¨£¬¹ØÓÚÕâЩֱ½ÓËÑË÷רҵÍøÕ¾°É£¬ÎÒÃÇÖ±½Ó¿´JAVAµÄ¾ßÌåʵÏÖ¡£
2.1 ¼ÓÃÜ
´úÂëÓÐÏêϸ½âÊÍ£¬²»¶à·Ï»°¡£
/**
* ¼ÓÃÜ
*
* @param content ÐèÒª¼ÓÃܵÄÄÚÈÝ
* @param password ¼ÓÃÜÃÜÂë
* @return
*/
public static byte[] encrypt(String content, String password) {
try {
KeyGenerator kgen = KeyGenerator.getInstance("AES");
kgen.init(128, new SecureRandom(password.getBytes()));
SecretKey secretKey = kgen.generateKey();
byte[] enCodeFormat = secretKey.getEncoded();
SecretKeySpec key = new SecretKeySpec(enCodeFormat, "AES");
Cipher cipher = Cipher.getInstance("AES");// ´´½¨ÃÜÂëÆ÷
byte[] byteContent = content.getBytes("utf-8");
cipher.init(Cipher.ENCRYPT_MODE, key);// ³õʼ»¯
byte[] result = cipher.doFinal(byteContent);
return result; // ¼ÓÃÜ
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (NoSuchPaddingException e) {
e.printStackTrace();
} catch (InvalidKeyException e) {
e.printStackTrace();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (IllegalBlockSizeException e) {
e.printStackTrace();
} c


Ïà¹ØÎĵµ£º

SHA 1ÕªÒªËã·¨Ô´Âë(java°æ)

public class SHA1 {
    private final int[] abcde = {
            0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0
        };
    // ÕªÒªÊý¾Ý´æ´¢Êý×é
  &nb ......

32λ²»¿ÉÄæ¼ÓÃÜËã·¨JavaʵÏÖ

¼ÓÃܺóÊÇÒ»¸ö32λ´óд×Öĸ×éºÏÐÎʽ£¬²¢ÇÒ±¾¼ÓÃÜ·½·¨²»¿ÉÄ棡
public String kljm(String dm,String kl)
{
String mw, cmm;
int k, i, tmp, a, hf, lf, bytes = 16;
int mm[], l,rand_seed;
rand_seed = 12345;
int len=kl.length();
if(len>=12) len=12;
mw =kl.substring(0,len) + dm.trim();
l = ......

java »ñµÃMAC Address

import java.net.InetAddress;
import java.io.InputStream;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.text.ParseException;
import java.util.StringTokenizer;
public final class NetworkInfo {
private final static String getMacAddress() throws IOException {
String ......

ÓÃJavaʵÏÖÀûÓÃËÑË÷ÒýÇæÊÕ¼¯ÍøÖ·µÄ³ÌÐò

±¾ÎIJÉÓÃJavaÓïÑÔд³É£¬ÒÔgoogleºÍ°Ù¶ÈËÑË÷ÒýÇæΪ¶ÔÏó¡£
 
ÎÒÃÇÒªÀûÓÃgoogle¡¢°Ù¶ÈËÑË÷ÒýÇæµÄËÑË÷¹æÔòÖеÄÁ½Ìõ£¬¹Ø¼ü×ÖËÑË÷ºÍinurlËÑË÷¡£Ê²Ã´ÊÇinurlËÑË÷£¬¾ÍÊÇÄãËùÒªËÑË÷µÄÍøÖ·Öб¾Éí´øÓеĹؼü×Ö£¬±ÈÈçhttp://www.xxx.com/post.asp ,Õâ¸öÍøÖ·¾Íº¬ÓÐpost.aspÕâÑùµÄ¹Ø¼ü×Ö£¬ÔÚËÑË÷ÒýÇæÖÐÌîд¹æÔòÊÇ inurl:post.asp,Õ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ