So with some experience you can often tell (or guess and test) what something is hashed with.
That said, revealing the exact algorithm would basically be throwing people with weak passwords to the wolves while really only supplying the rest of us with a false sense of security (because it will probably be cracked anyway).
We'd also be better off if they didn't announce the algorithm if the passwords get leaked (like with LinkedIn).
$6$AhHvI8ay$I0ED2wWVU9eheJKvCxzcbc/ZYRoN60q5XNHruYp8yFlQvEOjJ1WtIHUwjG6L4ZGntf3ei8osB7s2GYdkN01gx1
dGhpcyBpcyBzdHVwaWQKCg==
286755fad04869ca523320acce0dc6a4
some_salt:ac01346ad1553221506dd091800a1974
c8fed00eb2e87f1cee8e90ebbe870c190ac3848c
6b3a55e0261b0304143f805a24924d0c1c44524821305f31d9277843b8a10f4e
/5L0cR/wpFqSA
Note how they don't look the same, so it's quite easy for an attacker to tell the difference.Want to see how you did? Here's the answer key, in base64:
MTogTW9kZXJuIGNyeXB0LCBsaWtlIHRoZSBraW5kIHlvdSdkIGZpbmQgaW4gL2V0Yy9zaGFkb3cK
MjogSnVzdCBiYXNlNjRpbmcgdGhlIHJhdyBwYXNzd29yZCAoc3R1cGlkKQozOiBVbnNhbHRlZCBt
ZDVzdW0KNDogbWQ1c3VtLCB3aXRoIHNhbHQgcHJlcGVuZGVkCjU6IFVuc2FsdGVkIHNoYTFzdW0K
NjogVW5zYWx0ZWQgc2hhMjU2c3VtCjc6IE9sZCBVTklYIGNyeXB0KCk=Example: crypt stored the password in the format: $id$salt$encrypted
The security of your system can never depend on an attacker not knowing the implementation.
Or: Security through obscurity (is no security)
Using gimmicks like for example shuffling some characters in the hash may delay some attacks. But the problem is that these techniques are usually done on systems that have no sufficient security.
Have a big salt and use PBKDF2 or Bcrypt and you know the exact difficulty of getting the passwords.
Stripping off identifying info from hashes like talked about in this thread doesn't weaken the hash in any way, but instead makes it another thing to figure out by an attacker. At worse, you slow them down a bit, allowing you to do things like mass-email everybody affected.
Security is about depth, not putting 100% of your trust in a single algorithm. Even if that algorithm is well trusted. It's simply not an either/or.
Leaving identifiable bits in the hash makes it easier to do things like
if pass_type ($1$) { on_logon $upgrade_to_pass_type$6$)
> At worse, you slow them down a bit, allowing you to do things like mass-email everybody affected.
If you ever know at all.
Better to use 'not fast' hashes like bcrypt, scrypt, or PB(something) that requires far more work and far slower cracking.
Re hash: yeah, use a strong hash function. Never advocated otherwise.
Defense in depth is awesome, and not to be ignored. Just like we secure the database with a password, in addition to securing the server (with ssh keys), in addition to keeping software up to date, in addition to rate-limiting online password attempts, in addition to... well, you get the idea. Protect at every level. Make the attacker work as hard as possible.
Suppose you're doing the byte shuffling right? Or you split the hash value in two and you concatenate them in the reverse order, something like that.
Now here's the thing: if you have a determined attacker, they will figure out your code does that. So you gain no extra security from it
For a casual attacker this may be a bigger deterrent. Now, this casual attacker may try to create (or already has) an account, for which the password is known. So he goes and compares it trying to figure out your encryption mechanism
It's slightly more difficult than the guy that just used MD5 to hash the passwords (let's assume that's the minimum security people use - "in theory")
So, it's all fine and dandy until you have another 'increase the security' idea that actually decreases the security. And this is more common than you think.
Example: taking the hash and encrypting it (for some choices of hash and encryption)
(Not to mention when people think that because they use this 'improved security scheme' that they invented they can be lax in security elsewhere in the chain)
What I'm suggesting is that secrecy is a useful layer on top of a valid cryptography approach.
What you can do is that you can have the inputs to your hash function come from several places. User password, a salt per-password to protect against rainbow table attacks, a pepper forces an attacker to get both the application code, AND the database dump.
So it's bcrypt(password + salt + pepper). If you don't know the pepper, all of a sudden you have a 128+ character totally random password to break, instead of the user's totally insecure '12345'.
And in the case that you have the application code broken (ie, attacker gets the production code), well, then you're still using bcrypt, so no problem.
That step would protect against the common "db dump stolen off a dev's laptop" attack. Since the pepper only exists in production.
So yea, you're right that you can't just make shit up and hope for the best. But separating the data that needs to be stolen strengthens your overall defense.