code: public boolean verifyDigest(int digestPos, byte[] handshakeMessage, byte[] key, int keyLen) {
          if (log.isTraceEnabled()) {
              log.trace("verifyDigest - digestPos: {} keyLen: {} handshake size: {} ", digestPos, keyLen, handshakeMessage.length);
          }
          byte[] calcDigest = new byte[DIGEST_LENGTH];
          calculateDigest(digestPos, handshakeMessage, 0, key, keyLen, calcDigest, 0);
          if (!Arrays.equals(Arrays.copyOfRange(handshakeMessage, digestPos, (digestPos + DIGEST_LENGTH)), calcDigest)) {
              return false;
          }
          return true;
      }
docs: Verifies the digest.
  
  @param digestPos digest position
  @param handshakeMessage handshake message
  @param key contains the key
  @param keyLen the length of the key
  @return true if valid and false otherwise