using System.Collections.Generic;
public bool IsValidPassword(string password)
return (password + PasswordSalt).GetHashCode() == PasswordHash;
public string Username { get; set; }
PasswordSalt = Guid.NewGuid().ToString();
PasswordHash = (value + PasswordSalt).GetHashCode();
public int PasswordHash { get; set; }
public string PasswordSalt { get; set; }
static void Main(string[] args)
user1.Username = "ilyab";
user1.Password = "password123";
user2.Username = "ceasarm";
user2.Password = "password123";
if (user1.IsValidPassword("password123")) Console.WriteLine("Password is correct!");