'MYSQL and Python: Add salt after the first two characters of the password
I am working in MYSQL and Python. I have a table that stores users login information and want to make this secure. How do I add the salt after the first two characters of the password? I am then going to hash it using sha256.
The table looks like this:
username | password | salt |
---|---|---|
test | testing123 | abc09 |
I made the table using like this, bit if there is something you can implement here I am happy to redo it.
CREATE TABLE `user` (
`username` varchar(20) NOT NULL,
`password` varchar(100) NOT NULL,
`salt` varchar(100) DEFAULT NULL
);
Later I am going to use python to unhash and retrieve the password.
Solution 1:[1]
I found out that it is easier to do this thru python. I hash the password and insert the salt using hashlib.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Maria.A |