Is this a secure way to increase the calculation cost of md5 or sha1?
public static byte[] increaseHashComplexityMd5(byte[] hash, int loops)
{
for(int loop = 1; loop <= loops; loop++)
{
hash = md5(encryptAes(hash, reverseBits(hash)));
}
return hash;
}
public static byte[] increaseHashComplexitySha1(byte[] hash, int loops)
{
for(int loop = 1; loop <= loops; loop++)
{
hash = sha1(encryptAes(hash, reverseBits(hash)));
}
return hash;
}
- reverseBits reverses every bit of every byte, so 12345678 90111213 becomes 31211109 87654321.
- encryptAes encrypts the hash by the hash-with-reversed-bits, will result in a 16 x blocks result.
- md5/sha1 hashes the given bytes.
My goal is to make it harder to bruteforce hashes. On both platforms (C++ and Java), I already have the hash, aes and reverseBits functions, so something like this would be ideal. Will this do it, or is this insecure?