Example #1
0
 public Password(string password)
 {
     Policy.AssertPasswordMatchesPolicy(password); //Use a nested class to make the policy easily discoverable while keeping this class short and expressive.
     Salt           = Guid.NewGuid().ToByteArray();
     HashedPassword = PasswordHasher.HashPassword(salt: Salt, password: password);
     //Use a private nested class to keep this class short and readable while keeping the hashing logic private.
 }