• Post Reply Bookmark Topic Watch Topic
  • New Topic

XOR in byte array  RSS feed

 
Arthur Ritus
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to manipulate an MD5 hash digest. (which is 128 bit [or 16 bytes]).
I'm needing to write a method which will take in this value (as a byte array), perform XOR between the first 8 bytes and the last 8 bytes, and return me the value.
Any help/suggestions would be really appreciated.
 
Arthur Ritus
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry but should have added in the method that produces trhe 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;
}
 
jason adam
Chicken Farmer ()
Ranch Hand
Posts: 1932
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
shifty coder,
Welcome to the Ranch! We don't have many rules around here, but we do have a naming policy. You must have a first and a last name, separated. It doesn't have to be your real name, just a real looking one. As humorous as "shifty coder" is, it doesn't comply with this policy.
Please head over here and make this change.
Thanks!
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!