Advertisement
smbarbour

Calculate hash of digests

Feb 5th, 2014
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.36 KB | None | 0 0
  1. public static String calculateGroupHash(Set<String> digests) {
  2.     BigInteger hash = BigInteger.valueOf(0);
  3.     for (String entry : digests) {
  4.         try {
  5.             BigInteger digest = new BigInteger(Hex.decodeHex(entry.toCharArray()));
  6.             hash = hash.xor(digest);
  7.         } catch (DecoderException e) {
  8.             e.printStackTrace();
  9.         }
  10.     }
  11.     return Hex.encodeHexString(hash.toByteArray());
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement