There are multiple ways to generate MD5 hash in Java program. Not only Java API provides convenient method to generate MD5 hash, you can also use popular open source frameworks, like Spring and Apache commons Codec to generate MD5 digest in Java. MD5 is popular Message Digest Algorithm, which is most commonly used to check data integrity e.g. comparing MD5 check-sum to see, if any file is altered or not. Though, MD5 was not considered a good cryptographic algorithm for security purpose due to several vulnerability found on it, it's still good enough or checking integrity of file. MD5 hashing algorithm generate a 128 bit or 16 byte long hash value. MD5 hash values, also known as MD5 digest is mostly represented as 32 character Hex String. You can generate MD5 hash from a byte array, or String directly using Java, Spring and Apache commons codec. Spring and Apache commons codec has identical API e.g. class name DigestUtils is same and allows you to directly generate MD5 hash as Hex String, while if you use Java than you need to convert byte array to Hex String, as java.security.MessageDigest.digest() method returns MD5 hash as byte array. Earlier we have seen, How to encode and decode String in base64 encoding, and In this Java tutorial we will see, How to generate MD5 hash or digest using Java, Spring and Apache commons code library.
How to generate MD5 Hash in Java - String Byte Array digest Example
Read more »
0 Response to "How to generate MD5 Hash in Java - String Byte Array digest Example"
Posting Komentar