![]() |
Is this a good way to hash passwords?
Hi guys how are things :)
Ive recently been thinking of ways to make my passwords a little less hackable. Ive been thinking of using bcrypt or scrypt but in my way of thinking its not how good the hash encryption algorithm is but how you set your passwords out. I maybe wrong here as i have only been in this industry for 18 months. But i was thinking of having a salt password and pepper in sha256 which i know is not the best but still has a 256bit encryption which will slow the hacker down a few seconds lol.. Then i was thinking of cutting the password into 20 and scrambling it. Like so PHP Code:
Thanks **EDIT** For got to mention because the pepper is random, this is stored in a different table within the database to retrieve it when login is in effect. |
It doesn't really matter if it's in a separate table within the same database, if a hacker has access to one table, s/he has access to all tables.
Doing what you are doing will stump the amateur hacker, but a pattern is a pattern, regardless of how you slice and dice it. I won't say "this is worth it", but I also won't say this isn't worth it - Passwords are inherently and forever insecure |
IMO this is more work than you need. Sha256 would be 2^256 chance for collision, which is, well very high. I'm not a cryptographic expert by any far stretch of the imagination, but best I know sha256 has not been compromised as of yet. I wouldn't go to any effort to chop the strings up.
The ordering isn't desirable though. You have a salt and pepper that are added after the hash, which means that all passwords start and end with the same sequence. Instead, use hash('sha256', $salt . $password . $pepper); where salt and pepper could be anything, even a single byte that add uniqueness to the password. So two users with the passwords 'apassword' don't end up with the same password within storage.Cutting the string up isn't all that helpful overall. If software is compromised as well, than the pattern is a standard sequence in order to reassemble it. Since you cannot randomize it, you would either need to do pattern reassembly for it based on offset sequence, or you would need to calculate reassignment based on values. The latter is pretty much what the hashing algorithms are doing anyways. BTW, if you want to split that up, create an array instead using str_split instead. |
Quote:
So how would they do this. I know scrypt is meant to be the best but just because its the best now doesnt mean it will be in 12 months. For instance everyone thought sha was the best then hackers cracked it. |
Quote:
|
Secure passwords are not the end-all-be-all. You also need a secure database.
People/Businesses that get hacked are hacked because of other security weaknesses. Such as SQL injection, XSS, CSRF, session hijacking, whatever. These weaknesses give hackers the open doorway into your database where they can download your users table and then run the cracking script on your hashes. To secure your passwords, secure your database. Plug those holes. You're approaching the problem as if someone already has access to your database |
Quote:
|
| All times are GMT +1. The time now is 10:31 AM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.