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();
&nbs
Ïà¹ØÎĵµ£º
public static Object getCloneObject(Object bean) {
Object cloneBean = null;
try {
ByteArrayOutputStream byout = new ByteArrayOutputStream();
ObjectOutputStream obj = new ObjectOutputStream(byout);
obj.writeObject(bean);
ByteArrayInputStream byin = new ByteArrayInputStream(byou ......
Java 2 C++ http://www.javaeye.com/topic/295776
1. ½â¾öÐÔÄÜÎÊÌâ
Java¾ßÓÐƽ̨ÎÞ¹ØÐÔ£¬ÕâʹÈËÃÇÔÚ¿ª·¢ÆóÒµ¼¶Ó¦ÓõÄʱºò×ÜÊÇ°ÑËü×÷ΪÖ÷ÒªºòÑ¡·½°¸Ö®Ò»£¬µ«ÊÇÐÔÄÜ·½ÃæµÄÒòËØÓÖ´ó´óÏ÷ÈõÁËËüµÄ¾ºÕùÁ¦¡£Îª´Ë£¬Ìá¸ßJavaµÄÐÔÄܾÍÏÔµÃÊ®·ÖÖØÒª¡£Sun¹«Ë¾¼°JavaµÄÖ§³ÖÕßÃÇΪÌá¸ßJavaµÄÔËÐÐËÙ¶ÈÒѾ×ö³öÁËÐí¶àŬÁ¦£¬ÆäÖдó¶àÊý¼¯ÖÐ ......
String usrHome = System.getProperty("user.home");
ÏÂÃæÊÇSystemµÄ²ÎÊýÁбí
Key Meaning
------------------- ------------------------------
"file.separato ......
ÎÄÕÂת×Ô£º±ÈÌØÍø
±¾ÎÄÁ´½Ó£ºhttp://news.chinabyte.com/303/9117803.shtml
Java±¨±íÈí¼þÓ¦ÓÃÔÚjavaÓ¦ÓÃÏîÄ¿ÖУ¬ÄÜǶÈëʽµÄ½«java±¨±í¹¤¾ß²¿Êðµ½javaÓ¦ÓÃÖУ¬Äܹ²ÏíÓ¦Ó÷þÎñÆ÷Á¬½Ó³Ø£¬ÀûÓÃÓ¦Ó÷þÎñ¸ºÔð¾ùºâºÍ¼¯ÈºÌØÐÔ¡£Òò ......
1.1 ²»ÓÃnew¹Ø¼ü´Ê´´½¨ÀàµÄʵÀý
¡¡¡¡ÓÃnew¹Ø¼ü´Ê´´½¨ÀàµÄʵÀýʱ£¬¹¹Ô캯ÊýÁ´ÖеÄËùÓй¹Ô캯Êý¶¼»á±»×Ô¶¯µ÷Óᣵ«Èç¹ûÒ»¸ö¶ÔÏóʵÏÖÁËCloneable½Ó¿Ú£¬ÎÒÃÇ¿ÉÒÔµ÷ÓÃËüµÄclone()·½·¨¡£clone()·½·¨²»»áµ÷ÓÃÈκÎÀ๹Ô캯Êý¡£
¡¡¡¡ÔÚʹÓÃÉè¼Æģʽ£¨Design Pattern£©µÄ³¡ºÏ£¬Èç¹ûÓÃFactoryģʽ´´½¨¶ÔÏó£¬Ôò¸ÄÓÃclone()·½·¨´´½¨Ðµ ......