@@ -0,0 +1,983 @@
+package com.doctor.ch08;%0A%0Aimport java.nio.charset.StandardCharsets;%0Aimport java.security.MessageDigest;%0Aimport java.security.NoSuchAlgorithmException;%0A%0Aimport javax.xml.bind.DatatypeConverter;%0A%0A/**%0A * Secure hash functions%0A * %0A * @author sdcuike%0A *%0A *         Created on 2016%E5%B9%B44%E6%9C%8816%E6%97%A5 %E4%B8%8B%E5%8D%888:22:01%0A */%0Apublic class SecureHashFunctions %7B%0A%0A    public static void main(String%5B%5D args) throws NoSuchAlgorithmException %7B%0A        String message = %22This is a simple text message%22;%0A        String hashValue = getHashValue(message);%0A        System.out.println(hashValue);%0A        // 83c660972991049c25e6cad7a5600fc4d7c062c097b9a75c1c4f13238375c26c%0A    %7D%0A%0A    static final String hash_algorithm = %22SHA-256%22;%0A%0A    static String getHashValue(String message) throws NoSuchAlgorithmException %7B%0A        MessageDigest digest = MessageDigest.getInstance(hash_algorithm);%0A        byte%5B%5D b = digest.digest(message.getBytes(StandardCharsets.UTF_8));%0A        return DatatypeConverter.printHexBinary(b);%0A    %7D%0A%7D%0A

Secure hash functions