aspose file tools*
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
Author

XOR to reduce md5 digest

Arthur Ritus
Greenhorn

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");
md5.update(buffer);
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.....
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: XOR to reduce md5 digest