code: public static String calculateHash(MessageDigest d, byte[] bytes)
      {
          if (bytes == null)
          {
              return null;
          }
  
          d.update(bytes);
          return ByteUtilities.encode(d.digest());
      }
docs: Calculate an SHA-256 Hash String from the passed in byte[].