I have a datacontract and in my service I am trying to hash/salt the password datamember:
public void AddStudent(Student student)
{
student.StudentID = (++eCount).ToString();
byte[] passwordHash = Hash(student.Password, _passwordSalt); //invalid expression? _passwordSalt?
student.TimeAdded = DateTime.Now;
students.Add(student);
}
Can anyone help?
Try to replace the
_passwordSalt
with this functionGenerateSalt()
from one of my projects:By the way you have to save this generated salt. You need the same salt every time to check the password.