code: public byte[] hmac(byte[] key)
  	{
  		try {
  			Key secretKey = new SecretKeySpec(key, "HmacSHA1");
  			Mac hmac_algo = Mac.getInstance("HmacSHA1");
  			hmac_algo.init(secretKey);
  			hmac_algo.update(this.data);
  			for(Entry<String, byte[]> a: this.annotations.entrySet())   // this is in a fixed order because it is a SortedMap
  			{
  				if(!a.getKey().equals("HMAC"))
  					hmac_algo.update(a.getValue());
  			}
  			return hmac_algo.doFinal();
  		} catch (NoSuchAlgorithmException e) {
  			throw new PyroException("invalid hmac algorithm",e);
  		} catch (InvalidKeyException e) {
  			throw new PyroException("invalid hmac key",e);
  		}
  	}
docs: returns the hmac of the data and the annotation chunk values (except HMAC chunk itself)