1:16 AM
1

I read few answers about the question: why are hash collisions so dangerous? But did not get a really satisfying answer. Assume we are the first people who found a SHA256-collision, like sha256(\$§"%fa7asd8ft6sds) = sha256(889=?`/&&%"HSF) (this is not a real equation, but assume it is true). Why i...

18 hours later…
7:43 PM
@MaartenBodewes Well, I learned several things.
1) Dieharder is a PITA to get running.
2) DIEHARD is much easier
3) if you generate 32-bit integers by a process equivalent to multiplying 31-bit integers by two, you do not have nearly so much randomness.

8:00 PM
4) My algorithm is not so strong

Shame about 4. Maybe I should have pointed out to run Test01, which is an extension of Die harder and possibly easier to run. Anyway, glad you know where you are with the algorithm, even if it is not that strong.
Only generating even numbers is probably not the way to randomness no :P

8:25 PM
It was quick hack to turn 31 bits into 32: divide by 2^31 to get a value on the range [0,1], then multiply by 2^32 to get a 32-bit value. Oops!
It does look like it's reasonably unpredictable and has relatively even weighting though, so I think it works for my application.
Thanks for your help!

1 hour later…
9:46 PM
@fectin That's a very bad idea. Never use floats. Instead, just add a bit from the next call to the RNG.
If you want you can then use the remaining 30 for the next value, etc. So you just need to keep a 32 bit buffer basically. Shift and OR or XOR and AND for the masking, it's pretty easy if you know bit ops.

10:09 PM
@MaartenBodewes

That's me :)

That's essentially what I ended up doing. DIEHARD wanted rows of 80 ASCI hex characters, so I just generated 11 numbers/row and truncated.

Alright, I don't see how that exactly works, but I trust you got it right.

I suspect it could have artificially hidden some specific patterns, but since it wasn't robust anyway...
What's the issue with going to floats though?

Rounding errors.

10:13 PM
fair enough

In general we avoid floats in cryptography. Everything is translated to integer where possible, i.e. we use discrete math.