Digesting a String with MD5W can be done with the MessageDigest class. We can get a MessageDigest object that can be used to do an MD5 digest via MessageDigest.getInstance("MD5"). We can pass the MessageDigest a byte array representation of the String that we'd like to digest. Calling the digest() method on the MessageDigest object will return a byte array representation of the MD5 digest. It's very common to convert this to its Hex representation.
The MD5Digest class demonstrates this. It takes a String as an argument and displays the original String and the MD5 digest converted to hex.
Read full article from How do I generate an MD5 digest for a String? - Web Tutorials - avajava.com
No comments:
Post a Comment