File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Security and the fly likes XOR to reduce md5 digest Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Security
Bookmark "XOR to reduce md5 digest" Watch "XOR to reduce md5 digest" New topic

XOR to reduce md5 digest

Arthur Ritus

Joined: Dec 03, 2003
Posts: 5
Hello all,
Wondering if anyone can help me here:
I've found a nice method to generate an MD hash digest:
public static byte[] getKeyedDigest(byte[] buffer, byte[] key)
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
return md5.digest(key);
catch (NoSuchAlgorithmException e) {
return null;
This produces a 16 byte (128 bit) digest.
I need to reduce this into an 8 byte field by doing a XOR between the 1st and 2nd 8 bytes of the digest. Sounds simple but i'm finding it tricky to code. If anyone has any ideas i'd be very grateful.....
I agree. Here's the link:
subject: XOR to reduce md5 digest
It's not a secret anymore!