public Player(string username, string password, string passwordSalt = null, bool hashProvided = false) { _username = username; if (!hashProvided) { if (passwordSalt != null) { _passwordSalt = passwordSalt; } else { _passwordSalt = PasswordHashing.CreateSalt(8); } _passwordHash = PasswordHashing.CreatePasswordHash(password, _passwordSalt); } else { _passwordSalt = passwordSalt; _passwordHash = password; } }
public bool CheckPassword(string password) { string newPassHash = PasswordHashing.CreatePasswordHash(password, _passwordSalt); return(_passwordHash == newPassHash); }