How do I create a MD5 hash in Java?
-
This is the php script I'm using md5(md5(salt)md5(text)); How can I use this function in Java and get the same hash?
-
Answer:
MessageDigest is your friend. Call getInstance("MD5") to get an MD5 message digest you can use. import java.security.*; import java.math.*; String s="This is a test"; MessageDigest m=MessageDigest.getInstance("MD5"); m.update(s.getBytes(),0,s.length()); System.out.println("MD5: "+new BigInteger(1,m.digest()).toString(16));
Vinnie Matronia at Yahoo! Answers Visit the source
Related Q & A:
- How do I create a Cocoa Touch Framework?Best solution by stackoverflow.com
- How can I make a Spinner only by java?Best solution by stackoverflow.com
- How do I do a HTTP GET in Java (android?Best solution by Stack Overflow
- How do I create a digital signature and how do I use it?Best solution by support.office.com
- How do I create a new Yahoo screen name if I already have one?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.