File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Security and the fly likes How to generate MD5 hash? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Engineering » Security
Bookmark "How to generate MD5 hash?" Watch "How to generate MD5 hash?" New topic

How to generate MD5 hash?

M K Rayapudi
Ranch Hand

Joined: Feb 19, 2007
Posts: 160
I am using the following code to generate MD5 hash

Is this correct or not? (Why I am asking like this is because, sites like are showing a different hash)
What is wrong in my code?

Thank you.

Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42956
Does that site also use the UTF-32 encoding? MD5 predates Unicode, so that seems unlikely.

Furthermore, the digest is ASCII - no base64 encoding is necessary, so that site most likely doesn't do that.
Zandis Murāns
Ranch Hand

Joined: Aug 18, 2009
Posts: 174

ok, I'll just give you sample code, you study it by your own:
M K Rayapudi
Ranch Hand

Joined: Feb 19, 2007
Posts: 160
Thank you Dittmer & Zandis.
I agree. Here's the link:
subject: How to generate MD5 hash?
It's not a secret anymore!