HmacMD5 with Java

S

Stefan

Hi,

I need to generate a hash (HmacMD5), I am not familiar with JCE, can anyone
suggest a method to that would do this for me?

Thanks,

S
 
S

Shripathi Kamath

Stefan said:
Hi,

I need to generate a hash (HmacMD5), I am not familiar with JCE, can anyone
suggest a method to that would do this for me?

Thanks,

S

You may be able to do so with just the java.security package.

From
http://java.sun.com/j2se/1.4.2/docs/api/java/security/MessageDigest.html
where you see

MessageDigest md = MessageDigest.getInstance("SHA"); // <-- replace the SHA
with MD5, and try it out

try {
md.update(toChapter1);
MessageDigest tc1 = md.clone();
byte[] toChapter1Digest = tc1.digest();
md.update(toChapter2);
...etc.
} catch (CloneNotSupportedException cnse) {
throw new DigestException("couldn't make digest of partial content");
}


HTH,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,149
Latest member
Vinay Kumar Nevatia0
Top