Is there any method to generate MD5 hash of a string in Java?
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
Another implementation:
try this:
this one gives the exact md5 as you get from mysql's md5 function or php's md5 functions etc. This is the one I use (you can change according to your needs)
java.security.MessageDigest
is your friend. CallgetInstance("MD5")
to get an MD5 message digest you can use.If you actually want the answer back as a string as opposed to a byte array, you could always do something like this:
I just downloaded commons-codec.jar and got perfect php like md5. Here is manual.
Just import it to your project and use
and there you have it.