I'm trying to make a website with a log on / log off feature and I plan on properly hashing and salting the password. The problem I'm facing, however, is how I'd go about storing the password in the database. I know that I need to store the hashed + salted password in the database (not in plain text or plain encrypted), but I don't know how to technically get around inserting the binary data into the database.
In my early attempts, the only way I could get the data in the database would be to have the binary data converted to a base64 string and inserted into the varchar password field, but something is telling me that's not the correct way to do it.
The password field in the database is currently a varchar but as I understand it, a hashed password is binary. So even if I changed the password field to a binary object, I still don't know how to actually insert it!
If I'm not making any sense please ask for clarification and I'll get back to you.
byte[] pwdEntered = pw512.ComputeHash(System.Text.Encoding.Unicode.GetBytes(pwBox.Text));and the value that I'm putting in the database is the result of this:Convert.ToBase64String(pwdEntered). @Chris - it's not that I don't want to use base64, it's just this is the first time I've done this so I wasn't sure if that was an acceptable way to do it or if there was some other fancy way of doing it.