0
votes

Is there a known or perceived weakness to using the output of other hash algorithms as input for the next hash iteration?

Of course double hashing is not recommended, but this is not the same as double hashing.

Example:

I take a "secret" input and I hash it with SHA256, SHA384, and RIPEMD160 separately. I then combine the output of each into a single long string to use as input for a SHA512 hash. I then repeat this process repeatedly for a number of times.

In my mind, doing this significantly expands the length of the input into the SHA512 and essentially makes brute for even more infeasible.

Additionally, I considered using a 4th hash function merely to generate a value which could then be used to vary the length of the combined input string, by possibly discarding a few bytes in an unpredictable manner, so that the input is not a constant size. I'm not entirely sure that would be of any benefit.

Thoughts?

1
Using multiple hashed does not improve security other than requiring more time and there are better ways to achieve that such as PBKDF2, Argon2 and several platform specific methods. If this is not your use please provide information on what you are trying to accomplish. - zaph

1 Answers

0
votes

An answer to this question depends heavily on the attack scenario.

Of course double hashing is not recommended, but this is not the same as double hashing.

I would say: No! If you are storing passwords using a hash function, the attack on the store will be harder, if you use multiple rounds (feeding the output of round n as input for round n+1). Bitcoin as another example uses 2 passes (see here and here). For additional info see Why hashing twice?

by possibly discarding a few bytes in an unpredictable manner, so that the input is not a constant size. I'm not entirely sure that would be of any benefit.

That counteracts the way hash functions are designed. You want the function to produce the same output using the same input. Lifting this relationship basically destroys all use from the function. You could use a random number generator instead. See also: Does the MD5 algorithm always generate the same output for the same string? or Is sha-1 hash always the same?

In my mind, doing [...] essentially makes brute for even more infeasible.

The quoted statement is correct, but the reasoning is flawed. It makes brute force harder, because an attacker has to compute 4 functions instead of one. And she cannot use rainbow tables, because they aren't generated for your setup.

Wild guess: If you are using the mentioned setup to store and verify passwords, don't do it. Use PBKDF2 or bcrypt for that. See Password Storage Cheat Sheet