Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Comparing Encrypted Passwords in Database and User Input With Encrypto
- var hasher = new Hasher();
- hasher.SaltSize = 16;
- //Encrypts The password
- var encryptedPassword = hasher.Encrypt(txtPass.Text);
- Account newUser = new Account();
- System.Text.UTF8Encoding encoding=new System.Text.UTF8Encoding();
- newUser.accnt_User = txtUser.Text;
- newUser.accnt_Position = txtPosition.Text;
- newUser.accnt_Pass = new System.Data.Linq.Binary(encoding.GetBytes(encryptedPassword));
- var hasher = new Hasher();
- hasher.SaltSize = 16;
- var hashedPasswordToStoreInDB = hasher.Encrypt(passwordToSet);
- var hasher = new Hasher();
- hasher.SaltSize = 16;
- bool areEqual = hasher.CompareStringToHash(enteredPassword, hashFromDatabase);
Add Comment
Please, Sign In to add comment