code: private static String toSHA256String(String str) throws UnsupportedEncodingException {
      // Normalize the string before hashing.
      byte[] hash = digest.digest(toNormalizedString(str).getBytes("UTF-8"));
      StringBuilder result = new StringBuilder();
      for (byte b : hash) {
        result.append(String.format("%02x", b));
      }
  
      return result.toString();
    }
docs: Hash a string using SHA-256 hashing algorithm.
  
  @param str the string to hash.
  @return the SHA-256 hash string representation.
  @throws UnsupportedEncodingException If UTF-8 charset is not supported.