I hope this question isn't too similar to one that's already been asked. I also want to point out I know part the answer already, AFAIK: I just want some expert input on this.
Let's model a hash that more strictly is a possibly weak PBKDF. It would exist – if it worked – to slow down the cracking of passphrases (relatively short inputs), using well established secure hashes (i.e. SHA-2).
Looped hash on message (UserInput)
I'm well aware that modern ASIC/GPU technology would make cycling-hashing very brute-forceable on weak enough passwords and by cycling hashing I mean
PassHash := Hash(UserInput)
Do Loop 1024 times{
PassHash := Hash(PassHash)
}
Output := PassHash
In this routine, "Hash" may be SHA-256 (NOT HMAC, but a regular Hash). This pseudo-routine would be just as vulnerable to rainbow tables as SHA-256, AFAIK.
So, let's purpose a small alteration, instead we use this (also bad) "KDF":
Looped hash on salted message (UserInput | Salt)
PassHash := Hash(UserInput | Salt)
Do Loop 1024 times{
PassHash := Hash(PassHash | Salt)
}
Output := E(Hash(UserInput),Salt) | PassHash
E is performed with any good cipher that will take a 256bit key.
Above "Hash", would still be something like SHA-256. For example: Salt would be a randomly picked ~80 bits. The UserInput variable, (The Password/Passphrase) could be any length but ideally wants to be at least 112 bits.
PBKDF/2
In PBKDF/2, as I understand, we wouldn't use a HASH, but a HMAC (one reason being a lot of hash-functions are vulnerable to length-extension attacks).
Question
As I stated, I recon this code could be much worse than PBKDF2 and bCrypt and I can think of some reasons why. What I'ld like to know is: what are the biggest flaws in this routine, if any and why? And… maybe someone could demonstrate how we’ld go about attacking the design laid out above to show any major weaknesses?
Output
(currentlyOutput := E(Hash(PassHash),Salt) | PassHash
) rather than justOutput := PassHash
? – fgrieu Jan 19 '16 at 12:41