WCF / REST I / O Field

I have a datacontract and in my ministry I try to use the hash / salt password of the 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?

0
source share
1 answer

Try replacing _passwordSaltthis function GenerateSalt()with one of my projects:

protected RNGCryptoServiceProvider random = new RNGCryptoServiceProvider();

public byte[] GenerateSalt() {
    byte[] salt = new byte[10];
    random.GetNonZeroBytes(salt);
    return salt;
}

By the way, you need to save this generated salt. You need the same salt every time to check your password.

+1
source

All Articles