code: public static byte[] dgst(byte[] input, Digest digest) {
          checkNotNull(input);
          digest.update(input, 0, input.length);
          byte[] result = new byte[digest.getDigestSize()];
          digest.doFinal(result, 0);
          return result;
      }
docs: Calculates digest and returns the value as a byte[].
  
  @param input  input bytes
  @param digest digest algorithm
  @return digest as a byte[]