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.
No, a hashed password doesnt have to be stored in a varbinary field, you can encode it and store it in a varchar field. Base64 is a good alternative for encoding any kind of characters.