Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

XOR to reduce md5 digest  RSS feed

 
Arthur Ritus
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!