这是增加 md5 或 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 反转每个字节的每个位,因此 12345678 90111213 变为 31211109 87654321。
- encryptAes 通过 hash-with-reversed-bits 加密散列,将产生 16 x 块的结果。
- md5/sha1 散列给定的字节。
我的目标是让暴力破解哈希变得更加困难。在两个平台(C++ 和 Java)上,我已经有了 hash、aes 和 reverseBits 函数,所以这样的东西是理想的。这会做到吗,还是不安全?