class MessageDigestUtil {

    public static MessageDigest createMessageDigest(String hashAlgorithm) {
        try {
            switch (hashAlgorithm) {
                case "S256":
                    return MessageDigest.getInstance("SHA-256");
                case "S384":
                    return MessageDigest.getInstance("SHA-384");
                case "S512":
                    return MessageDigest.getInstance("SHA-512");
                default:
                    return MessageDigest.getInstance(hashAlgorithm);
            }
        } catch (NoSuchAlgorithmException e) {
            throw new IllegalArgumentException(e);
        }
    }

    private  MessageDigestUtil();

}