### Question:
SignalUtil { public static byte[] hmacSha1(byte[] data, byte[] key) { try { SecretKeySpec signingKey = new SecretKeySpec(key, "HmacSHA1"); Mac mac = Mac.getInstance("HmacSHA1"); mac.init(signingKey); return mac.doFinal(data); } catch (Exception e) { throw new RuntimeException(e); } }  static int intFromTwoBytes(byte[] bytes); static byte[] fourBytesFromInt(int n); static byte[] twoBytesFromInt(int n); static int intFromFourBytes(byte[] bytes); static int unsign(byte by); static byte sign(int by); static byte[] joinBytesArrays(byte[]... args); static byte[] joinBytesArrays(List<byte[]> args); static int multipleOfFour(int start); static byte[] xor(byte[] a, byte[] b); static long computeCRC32(byte[] bytes); static long computeCRC32c(byte[] bytes); static byte[] flipBytes(byte[] bytes); static byte[] longToFourBytes(long l); static byte[] longToFourBytesFlip(long l); static byte[] longToBytes(long l); static byte[] padToMultipleOfFour(byte[] bytes); static long bytesToLong(byte[] l); static byte[] md5key(byte[] key); static byte[] hmacSha1(byte[] data, byte[] key); static ByteRange range(int a, int b); static byte[] copyRange(byte[] bytes,ByteRange range); static List<byte[]> split(byte[] data,int chunkSize); static byte[] randomBytes(int lgt);  }### Answer:
@Test public void findIntegrity() throws DecoderException { String bytes = "000100502112a442e9dec49e8038338d00f9a79c0006001162323064306166343a623230643061663400000000250000002400046e7f00ff802a00081eb6ff2cf7589cd700080014020b27ff78fbd931427c9f4518b9f40d5415562e8028000473cf7c86"; String noFinger2 = "000100482112a442e9dec49e8038338d00f9a79c0006001162323064306166343a623230643061663400000000250000002400046e7f00ff802a00081eb6ff2cf7589cd7"; byte[] msg = Hex.decodeHex(noFinger2.toCharArray()); byte[] mac = Hex.decodeHex("020b27ff78fbd931427c9f4518b9f40d5415562e".toCharArray()); String password = "230f754083a9070aff5bd1ced7654a9c"; byte[] compMac = SignalUtil.hmacSha1(msg,password.getBytes()); System.out.println(Hex.encodeHexString(mac) +" " + Hex.encodeHexString(compMac)); assertTrue(Arrays.equals(mac,compMac)); }