php - How secure is my hashing algorithm? -
I am writing a website for personal use (I hope, but do not think anyone will ever come there) , And its development follows the following algorithms:
function encrypt password ($ user name, $ password) {$ username = md5 ($ username); $ Password = md5 ($ password); $ Newpass = substr ($ username, 0, 5). $ Password substr ($ username, 5); $ Newpass = MD5 ($ Newpass); Return $ newpass; } Since it's still a type of 'password and you're like' (though in general), I think it would be a better idea to hide the password database In.
I have used the simple MD5x1 algorithm (originally: MD5 (pass) and previously) but then people who access the database can easily change the hash. In this way I do not think you want to change this thing.
Not so. / p>
- MD5 is cryptographicly weak.
- Salt should be random, should not be obtained by known values.
- One round of palm is trivial to break these days.
The solution given above:
- Use better algorithms, preferably SHA2 or better.
- Generate random salts.
- hash several rounds
Oh wait, an entire library has already been created in PHP, it's better than method , And if you are using version 5.5 of PHP, it was implemented, which backported it back as 5.3.7, and if that still does not work So you actually update your PHP installation. Lastly, unless you have a college level education in cryptography, then you should never try to 'roll your own' rolling or encryption schemes. 99% of the time you will end up with the least safe system, if you use some industry-standard.
Comments
Post a Comment