code: protected DataHash calculateMac() throws KSIException {
          try {
              HashAlgorithm algorithm = HashAlgorithm.getByName("DEFAULT");
              algorithm.checkExpiration();
              return new DataHash(algorithm, Util.calculateHMAC(getContent(), this.loginKey, algorithm.getName()));
          } catch (IOException e) {
              throw new KSIProtocolException("Problem with HMAC", e);
          } catch (InvalidKeyException e) {
              throw new KSIProtocolException("Problem with HMAC key.", e);
          } catch (NoSuchAlgorithmException e) {
              // If the default algorithm changes to be outside of MD5 / SHA1 /
              // SHA256 list.
              throw new KSIProtocolException("Unsupported HMAC algorithm.", e);
          } catch (HashException e) {
              throw new KSIProtocolException(e.getMessage(), e);
          }
      }
docs: Calculates the MAC based on header and payload TLVs.
  
  @return Calculated data hash.
  @throws KSIException
  if HMAC generation fails.