public Admin validateAndConvert() throws ValidointiPoikkeus, InvalidAdminPoikkeus, 
	NoSuchAlgorithmException, UnsupportedEncodingException{
		
		Validator validator = new Validator();
		
		validator.validateUsername(username, "username", 3, 20);
		validator.validatePassword(password1, password2, "password1", "password2", 7, 20);
		
		if(validator.getVirheet().size() > 0) {
			ValidointiVirheet virheet = validator.getVirheet();
			throw new ValidointiPoikkeus(virheet);
		}
		else {
			String hashedPassword;
			String salt;

			salt = Hasher.generateSalt();
			hashedPassword = Hasher.hash(password1, salt);

			Admin admin = new Admin(username, hashedPassword, salt);
			return admin;

		}
		
	}