ʹÓà Java Éú³É MD5 ±àÂë
MD5¼´Message-Digest Algorithm 5£¨ÐÅÏ¢-ÕªÒªËã·¨5£©£¬ÊÇÒ»ÖÖÓÃÓÚ²úÉúÊý×ÖÇ©ÃûµÄµ¥ÏîÉ¢ÁÐËã·¨£¬ÔÚ1991ÄêÓÉMIT Laboratory for Computer Science£¨IT¼ÆËã»ú¿ÆѧʵÑéÊÒ£©ºÍRSA Data Security Inc£¨RSAÊý¾Ý°²È«¹«Ë¾£©µÄRonald L. Rivest½ÌÊÚ¿ª·¢³öÀ´£¬¾ÓÉMD2¡¢MD3ºÍMD4·¢Õ¹¶øÀ´¡£MD5Ëã·¨µÄʹÓò»ÐèÒªÖ§¸¶ÈκΰæȨ·ÑÓá£ËüµÄ×÷ÓÃÊÇÈôóÈÝÁ¿ÐÅÏ¢ÔÚÓÃÊý×ÖÇ©ÃûÈí¼þǩ˽ÈËÃܳ×Ç°±»"ѹËõ"³ÉÒ»ÖÖ±£Ãܵĸñʽ£¨½«Ò»¸öÈÎÒⳤ¶ÈµÄ"×Ö½Ú´®"ͨ¹ýÒ»¸ö²»¿ÉÄæµÄ×Ö·û´®±ä»»Ëã·¨±ä»»³ÉÒ»¸ö128bitµÄ´óÕûÊý£¬»»¾ä»°Ëµ¾ÍÊÇ£¬¼´Ê¹Äã¿´µ½Ô´³ÌÐòºÍËã·¨ÃèÊö£¬Ò²ÎÞ·¨½«Ò»¸öMD5µÄÖµ±ä»»»ØÔʼµÄ×Ö·û´®£¬´ÓÊýѧÔÀíÉÏ˵£¬ÊÇÒòΪÔʼµÄ×Ö·û´®ÓÐÎÞÇî¶à¸ö£¬ÕâÓеãÏó²»´æÔÚ·´º¯ÊýµÄÊýѧº¯Êý¡££©
ÔÚ Java ÖУ¬java.security.MessageDigest ÖÐÒѾ¶¨ÒåÁË MD5 µÄ¼ÆË㣬ËùÒÔÎÒÃÇÖ»ÐèÒª¼òµ¥µØµ÷Óü´¿ÉµÃµ½ MD5 µÄ128 λÕûÊý¡£È»ºó½«´Ë 128 λ¼Æ 16 ¸ö×Ö½Úת»»³É 16 ½øÖƱíʾ¼´¿É¡£
´úÂëÈçÏ£º
package com.tomove.util;
/**
* MD5µÄËã·¨ÔÚRFC1321 Öж¨Òå ÔÚRFC 1321ÖУ¬¸ø³öÁËTest suiteÓÃÀ´¼ìÑéÄãµÄʵÏÖÊÇ·ñÕýÈ·£º MD5 ("") =
* d41d8cd98f00b204e9800998ecf8427e MD5 ("a") = 0cc175b9c0f1b6a831c399e269772661
* MD5 ("abc") = 900150983cd24fb0d6963f7d28e17f72 MD5 ("message digest") =
* f96b697d7cb7938d525a2f31aaf161d0 MD5 ("abcdefghijklmnopqrstuvwxyz") =
* c3fcd3d76192e4007dfb496cca67e13b
*
* @author haogj
*
* ´«Èë²ÎÊý£ºÒ»¸ö×Ö½ÚÊý×é ´«³ö²ÎÊý£º×Ö½ÚÊý×éµÄ MD5 ½á¹û×Ö·û´®
*/
public class MD5 {
public static String getMD5(byte[] source) {
String s = null;
char hexDigits[] = { // ÓÃÀ´½«×Ö½Úת»»³É 16 ½øÖƱíʾµÄ×Ö·û
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd',
'e', 'f' };
try {
java.security.MessageDigest md = java.security.MessageDigest
.getInstance("MD5");
md.update(source);
byte tmp[] = md.digest(); // MD5 µÄ¼ÆËã½á¹ûÊÇÒ»¸ö 128 λµÄ³¤ÕûÊý£¬
// ÓÃ×Ö½Ú±íʾ¾ÍÊÇ 16 ¸ö×Ö½Ú
char str[] = new char[16 * 2]; // ÿ¸ö×Ö½ÚÓà 16 ½øÖƱíʾµÄ»°£¬Ê¹ÓÃÁ½¸ö×Ö·û£¬
// ËùÒÔ±íʾ³É 16 ½øÖÆÐèÒª 32 ¸ö×Ö·û
int k = 0; // ±íʾת»»½á¹ûÖжÔÓ¦µÄ×Ö·ûλÖÃ
for (int i = 0; i < 16; i++) { // ´ÓµÚÒ»¸ö×Ö½Ú¿ªÊ¼£¬¶Ô MD5 µÄÿһ¸ö×Ö
Ïà¹ØÎĵµ£º
×î½ü¿´µ½ÂÛ̳ÀïÓиöÌû×ÓÔÚÌÖÂ۽ӿںͳéÏóÀàµÄÇø±ðºÍ×÷Óã¬ÕâÆäʵҲÊǺܶàÃæÊÔ¹Ùϲ»¶ÎʵÄÎÊÌ⣬ÕâÀïÎÒ¾Í˵˵ÎÒµÄ×ܽᣬ˳±ã˵˵ÄÚ²¿ÀàµÄ×÷Ó㬵±ÊǸø¸ÕÈëÃÅ£¬»òÕßÏëѧϰjavaµÄͬѧÃÇÄܸüºÃµÄÀí½âËüÃǵÄÓ÷¨¡£
1.½Ó¿Ú(interface)£¬½Ó¿Ú±»ÓÃÀ´½¨Á¢ÀàÓëÀàÖ®¼ä¹ØÁªµÄ±ê×¼¡£
Java code
public interface ITest{
public ......
ÔÚEclipseÖÐÎÒÃǾ³£»áÏòÖ÷·½·¨×¢Èë²ÎÊý£¬ÒÔÌṩ¸ø³ÌÐòµÄÔËÐУ¬Æä·½·¨ÈçÏ£º
1.µãÔËÐа´Å¥£¨»òÓÒ»÷ÒªÔËÐеÄÀࣩ
2.µã»÷Open Run Dialog..
3.Ñ¡ÖÐ×ó²àÐèÒªÔËÐеÄÀà
4.ÔÚÓÒ²àÑ¡ÖÐArgument
5.ÔÚProgram ArgumentÖÐÊäÈëÄãҪעÈëµ½Ö÷º¯ÊýÖеIJÎÊý
6.µã»÷ÔËÐУ¨Run£©£¬¾Í¿ÉÒÔÔËÐÐÁË¡£¡£¡£ ......
¶¹¶¹Íø ¼¼ÊõÓ¦ÓÃƵµÀ 2009Äê06ÔÂ10ÈÕ ¡¾×ֺţºÐ¡ÖÐ´ó¡¿ Êղر¾ÎÄ
JProfiler memcached JavaCC EclEmma Jester Java¼ÓÃܼ¼Êõ£¨Æߣ©¡£
¡¡¡¡ECC
¡¡¡¡ECC-Elliptic Curves Cryptography£¬ÍÖÔ²ÇúÏßÃÜÂë±àÂëѧ£¬ÊÇÄ¿Ç°ÒÑÖªµÄ¹«Ô¿ÌåÖÆÖУ¬¶Ôÿ±ÈÌØËùÌṩ¼ÓÃÜÇ¿¶È×î¸ßµÄÒ»ÖÖÌåÖÆ¡£ÔÚÈí¼þ×¢²á ......
HMAC
HMAC£¨Hash Message Authentication Code£¬É¢ÁÐÏûÏ¢¼ø±ðÂ룬»ùÓÚÃÜÔ¿µÄHashËã·¨µÄÈÏÖ¤ÐÒé¡£ÏûÏ¢¼ø±ðÂëʵÏÖ¼ø±ðµÄÔÀíÊÇ£¬Óù«¿ªº¯ÊýºÍÃÜÔ¿²úÉúÒ»¸ö¹Ì¶¨³¤¶ÈµÄÖµ×÷ΪÈÏÖ¤±êʶ£¬ÓÃÕâ¸ö±êʶ¼ø±ðÏûÏ¢µÄÍêÕûÐÔ¡£Ê¹ÓÃÒ»¸öÃÜÔ¿Éú³ÉÒ»¸ö¹Ì¶¨´óСµÄСÊý¾Ý¿é£¬¼´MAC£¬²¢½«Æä¼ÓÈëµ½ÏûÏ¢ÖУ¬È»ºó´«Êä¡ ......
±¾ÈË´Óʽü10ÄêµÄjava¿ª·¢£¬×ܽáÒ»Ì×ÓÐЧµÄjavaʵսÊÓƵ½Ì³Ì£¬°üÀ¨£ºjava»ù´¡¡¢jspÅàѵ¡¢strutsʹÓá¢hibernateʹÓúÍspringµÄʹÓ㬻¹°üº¬´óÁ¿µÄÅàѵ´úÂ룬ÒÔ¼°sshÕûºÏ¿ª·¢È«¹ý³Ì¡£±¾Ì×ÊÓƵ5Ô·ݾͽ«Â¼ÖÆÍê³É£¬Èç¹ûÄúÓÐÒâÇëÁªÏµÎÒ£¬ÎÒµÄQQ£º1429154728 ......