How to geranate verification hash


Geranate verification hash using SHA256 algorith


Java code for gerenating verification hash


public class SHA256Algorithm
{
    public static String generateSHA256Hash(String text)throws
    NoSuchAlgorithmException
    {
        String str = text;
        MessageDigestmessageDigest = MessageDigest.getInstance("SHA-256");
        String generatedVerificationHash =
        getString(messageDigest.digest(str.getBytes()));
        returngeneratedVerificationHash;
    }
    private static String getString(byte buf[])
    {
        StringBuffersb = new StringBuffer(2 * buf.length);
        for (int i = 0; i > 4;
            int l = (buf[i] & 0x0f);
            sb.append(new Character((char) ((h > 9) ? 'a' + h - 10 : '0' + h)));
            sb.append(new Character((char) ((l > 9) ? 'a' + l - 10 : '0' + l)));
        }
        returnsb.toString();
    }
}