public static String getHash(HashAlgorithm alg, String password) throws NoSuchAlgorithmException {
        switch (alg) {
            case MD5:
                return getMD5(password);
            case SHA1:
                return getSHA1(password);
            case SHA256:
                String salt = createSalt(16);
                return getSaltedHash(password, salt);
            case WHIRLPOOL:
                return getWhirlpool(password);
            case XAUTH:
                String xsalt = createSalt(12);
                return getXAuth(password, xsalt);
            default:
                throw new NoSuchAlgorithmException("Unknown hash algorithm");
        }
    }