You don't, it's a one-way hash algorithm.  The normal way to use it is to
store the hash value of the user's password (or whatever you want to hash)
in some persistent store, then when the user returns and re-enters his
password, hash that and compare the two hash values.  If they match the user
is golden, if not ask them to try again.
    (*Chris*)

----- Original Message -----
From: "Sharon Rose Orillaneda" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, July 18, 2001 11:07 PM
Subject: Re: [JSP-INTEREST] MD5 example


> Do you know how to decrypt MD5?
> Thanks
> -Sharon
>
> -----Original Message-----
> From: A mailing list about Java Server Pages specification and reference
> [mailto:[EMAIL PROTECTED]]On Behalf Of Ashish Shrestha
> Sent: Thursday, 19 July 2001 2:04 PM
> To: [EMAIL PROTECTED]
> Subject: MD5 example
>
>
> Dear Hardeep,
>
> I have included an example of MD5 for you.
> If you want to use the 16 byte data instead of convert it to hex string
> just return the md5.digest().
>
> Hope this helps.
>
> Ashish
> http://headlines.sourceforge.net
>
>         /**
>                 Generate a MD5 digest and return as hex.
>
>                 @param s String for which MD5 is to be generated.
>                 @returns 32 character hex representation of the MD5
> digest.
>         */
>         public static  String md5Hex(String s)
>                 throws NoSuchAlgorithmException{
>
>                 MessageDigest md5 = MessageDigest.getInstance("MD5");
>                 md5.update(s.getBytes());
>
>                 return bytesToHexString(md5.digest());
>         }
>
>         public static String bytesToHexString(byte[] b){
>                 char[] hexChars = {'0','1','2','3','4','5','6','7',
>                         '8','9','A','B','C','D','E','F'};
>
>                 StringBuffer hexString = new StringBuffer();
>
>                 for (int i = 0; i < b.length; i++){
>                         hexString.append(hexChars[(b[i] >> 4) & 0x0f]);
>                         hexString.append(hexChars[b[i] & 0x0f]);
>                 }
>
>                 return hexString.toString();
>         }
>
>
===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>
>
===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to