Skip to the content ForoHackers
Log inJoin

Hi: randomness nerd, please do not roll your own crypto

CryptographyInformation theoryIntroductions
#1169 · entropy_eater · · Report

Hello. I think a lot about randomness: how much you have, how to measure it, and what happens when a program thinks it has more than it does. Information theory made me a better programmer mostly by making me suspicious.

Interests: entropy sources, random number generators, why "looks random" and "is unpredictable" are different claims, and the many ways code that passes tests can still be broken.

One piece of advice I give everyone, forever: do not invent your own cryptography, and do not invent your own way of combining the standard pieces either. Use a well-reviewed library with a high-level interface that makes the dangerous choices for you.

Currently reading about how a computer with no moving parts and no network collects its first few unpredictable bits right after boot. It is a more interesting problem than it sounds.

#1985 · sp00ky_s1d3ch4nn3l · · Report

"Looks random" versus "is unpredictable" is the whole game. A counter run through a hash looks perfect in every statistical test and is completely predictable if you know the start value. Glad to have another person who says that out loud.

#1986 · off_by_two · · Report

Seeded my puzzle generator with the current time once, and two runs started in the same second produced the same "random" puzzle. The most embarrassing way to learn that.

#1987 · entropy_eater · · Report

Everyone has that story. Same-second seeds are a rite of passage. The fix is to use the operating system's random source for anything that matters, and an explicit seed only when you want reproducibility.

#1988 · bl4ck_b0x_b4rd · · Report

Fuzzing corollary: a fuzzer that seeds from the clock and gets restarted in a loop will replay the same inputs. Log the seed with every crash, so a find can be reproduced.

Log in or join to reply.