grump wrote: ↑Sun Jan 09, 2022 2:56 pm
Wow, that code borders strongly on gibberish territory
Why?
grump wrote: ↑Sun Jan 09, 2022 2:56 pm
A simple sponge function is much simpler and shorter:
Well, that's not a true sponge function, as the initialization does not "absorb" the input (seed) in the way that sponge functions do. It's just an iterated hash. Also since a hash is not a [edit: cyclic] permutation function, there's no guarantee that you won't hit a short cycle.
grump wrote: ↑Sun Jan 09, 2022 2:56 pm
md5 because it's probably the fastest hash function, and using your unpack idea. Not sure about periodicity and the 'i6' thing.
I used sha512 because it produces the most output per call, so it avoids as many calls as possible. I imagined that one sha512 would be faster than four md5's. But in a benchmark, in isolation, that turns out not to be the case, by a tight margin: four MD5s are about 3% faster. I also checked SHA1; three SHA1s are about 45% slower than one SHA512, and produce less output.
The problem of the periodicity is that it's unpredictable; you'd need a
cyclic permutation function instead of a hash, to guarantee maximum period. The counter method is guaranteed to have a period as large as the counter can reach.
i6 is OK.