### Question:
Crypto { public static byte[] hmacSha1(byte[] key, byte[] in) throws GeneralSecurityException { if (key.length < MIN_HMAC_KEY_LEN) { throw new GeneralSecurityException("HMAC key should be at least " + MIN_HMAC_KEY_LEN + " bytes."); } Mac hmac = Mac.getInstance(HMAC_TYPE); Key hmacKey = new SecretKeySpec(key, HMAC_TYPE); hmac.init(hmacKey); hmac.update(in); return hmac.doFinal(); } private  Crypto(); static String getRandomString(int numBytes); static String getRandomDigits(int len); static byte[] getRandomBytes(int numBytes); static byte[] hmacSha1(byte[] key, byte[] in); static void hmacSha1Verify(byte[] key, byte[] in, byte[] expected); static byte[] aes128cbcEncrypt(byte[] key, byte[] plain); static byte[] aes128cbcEncryptWithIV(byte[] key, byte[] iv, byte[] plain); static byte[] aes128cbcDecrypt(byte[] key, byte[] cipherText); static byte[] aes128cbcDecryptWithIv(byte[] key, byte[] iv,
      byte[] cipherText, int offset); static byte[] concat(byte[] a, byte[] b); static final SecureRandom RAND; final static int CIPHER_KEY_LEN; final static int HMAC_SHA1_LEN; }### Answer:
@Test public void testHmacSha1() throws Exception { String key = "abcd1234"; String val = "your mother is a hedgehog"; byte[] expected = { -21, 2, 47, -101, 9, -40, 18, 43, 76, 117, -51, 115, -122, -91, 39, 26, -18, 122, 30, 90, }; byte[] hmac = Crypto.hmacSha1(key.getBytes(), val.getBytes()); assertArrayEquals(expected, hmac); }