public static byte[] generateFor(byte[] unidentifiedAccessKey) {
    try {
      if (unidentifiedAccessKey.length != UnidentifiedAccessUtil.UNIDENTIFIED_ACCESS_KEY_LENGTH) {
        throw new IllegalArgumentException("Invalid UAK length: " + unidentifiedAccessKey.length);
      }

      Mac mac = Mac.getInstance("HmacSHA256");
      mac.init(new SecretKeySpec(unidentifiedAccessKey, "HmacSHA256"));

      return mac.doFinal(new byte[32]);
    } catch (NoSuchAlgorithmException | InvalidKeyException e) {
      throw new AssertionError(e);
    }
  }
@Test
  public void generateForIllegalArgument() {
    final byte[] invalidLengthUnidentifiedAccessKey = new byte[15];
    new SecureRandom().nextBytes(invalidLengthUnidentifiedAccessKey);

    assertThrows(IllegalArgumentException.class, () -> UnidentifiedAccessChecksum.generateFor(invalidLengthUnidentifiedAccessKey));
  }