# Can we modify any hash function like SHA-1 or MD5 to perform multiple iterations at once to gain calculation speed?

Is it mathematically possible to adapt a given hash function (f.e. SHA-1 or MD5) so it performs a known number of iterations at once?

Concrete example would be:

data = SHA1_10000(data)


for (i = 0; i < 10000; i++) data = SHA1(data)


while resulting in the same output, but being 10000 times faster.

• What you ask is not possible via modification to hash. However, you could be interested in Merkle tree (also known as hash tree), which is a way to use hash that (in some settings) allows gaining speed by enabling (amongst other things) parallel computation of blocks of input. Jan 28 '18 at 15:29