The generation of random or pseudorandom data, and the use of randomness in security protocols

learn more… | top users | synonyms

72
votes
3answers
10k views

Is a rand from /dev/urandom secure for a login key?

Lets say I want to create a cookie for a user. Would simply generating a 1024 bit string by using /dev/urandom, and checking if it already exists (looping until I get a unique one) suffice? Or should ...
27
votes
8answers
12k views

Feeding /dev/random entropy pool?

Which way of additionally feeding /dev/random entropy pool would you suggest for producing random passwords? Or, is there maybe a better way to locally create fully random passwords?
10
votes
4answers
1k views

How insecure are non-cryptographic random number generators?

I always hear that C rand() is not secure, but what how many calls would you need to know in order to predict the next value (or at least cut down the possibilities)? Would they have to be sequential? ...
33
votes
5answers
5k views

Are GUIDs safe for one-time tokens?

I see a lot of sites use GUIDs for password resets, unsubscribe requests and other forms of unique identification. Presumably they are appealing because they are easy to generate, unique, ...
17
votes
3answers
4k views

How long should a random nonce be?

NIST provides good guidelines on the length of keys and hashes for various algorithms. But I don't see anything specifically on the length of a random or pseudo-random nonce (number used once). If ...
4
votes
3answers
2k views

How insecure are PHP's rand functions?

There are some pseudo-random-number generators in PHP: rand(), srand(), mt_rand(), mt_srand(). You can look at their code here. I understand those functions are insecure, but how insecure are they? ...
10
votes
5answers
2k views

Do mobile OS's provide crypto-quality randomness?

Which mobile OS's provide a primitive to generate crypto-quality randomness that applications can use? On desktop systems, these features are pervasive. Unix provides /dev/urandom. Windows provides ...
9
votes
4answers
8k views

License key / Serial number generator and checker

I need a serial number generator and accompanying checker. I would like to be able to set a salt (and maybe a length). The generator should only produce serial numbers that pass the test of the ...
16
votes
2answers
459 views

What statistics can be used to identify pseudorandom data?

I'm working on some code that attempts to identify files whose contents appear to be "random". As such, I'm looking for statistical measures that can be used to identify such randomness. I've ...
13
votes
2answers
1k views

Evaluating the entropy gathering in a PRNG

I'm reviewing the random number generator (expected to be of cryptographic quality) on an embedded device. My point of view here is the operating system and crypto library implementer. I'm ...
15
votes
2answers
1k views

Flaw in encryption through pseudorandom number stream (from gpg documentation)

I was reading PGP docs and came upon a part written by Phil Zimmermann (PGP's creator) that piqued my curiosity: When I was in college in the early 70s, I devised what I believed was a brilliant ...
5
votes
1answer
552 views

Should I include a random padding in every HTTPS request and response?

According to the following paper, it is possible to decrypt HTTPS traffic by inspecting AJAX calls and using the size parameter as a cryptographic oracle. Should I be sending a variable length ...
14
votes
2answers
3k views

Cracking a linear congruential generator

I was recently listening to the security now podcast, and they mentioned in passing that the linear congrunential generator (LCG) is trivial to crack. I use the LCG in a first year stats computing ...
-5
votes
5answers
711 views

create a variants of MD5

I have also asked similar q here : To create a variants of MD5, I made following changes : MD5 uses a non-linear sin(i)* pow(2,32) ----> i plane to use cos(i)*pow(2,32) Instead ...
33
votes
6answers
5k views

Are random URLs a safe way to protect profile photos?

I would like to move from sequential to random user-ids so I can host profile photos publicly. i.e. example.com/profilepics/asdf-1234-zxcv-7890.jpg How long must user-ids be to keep anyone from ...
14
votes
3answers
502 views

Why CSRF Token has to be a Cryptographically Strong Random number, in Double Submit Cookies method?

I was just going through the OWASP's Cheat Sheet for CSRF Prevention. In the Double Submit Cookies method, I saw this the site should generate a (cryptographically strong) pseudorandom value ...
10
votes
4answers
3k views

Generate cryptographically strong pseudorandom numbers in Javascript?

Is there any good way to generate cryptographically strong pseudorandom (or true random) numbers in Javascript? The crucial requirement: if a.com's Javascript generates some random numbers, no one ...
12
votes
4answers
3k views

Why OpenSSL can't use /dev/random directly?

I couldn't find the answer for the reason anywhere, even the wiki page doesn't explain it. This seems like using a PRNG for seeding an another PRNG. The first one (/dev/random) may itself be seeded by ...
12
votes
2answers
520 views

Correct way to get a number from 0-9 from a random byte?

If I have a good random number generator that gives me a byte of data at a time, and I want to extract a random decimal digit of 0 to 9 from that byte stream, what is the correct way to do that? At ...
7
votes
4answers
4k views

What do I need to configure, to make sure my software uses /dev/urandom?

When setting up a server, what configuration changes do I need to make sure that all of the software uses /dev/urandom instead of /dev/random? Some servers don't have much entropy in the entropy pool ...
18
votes
3answers
696 views

Does (online) poker require cryptographically secure randomness?

Here’s a quote from a reddit discussion: … for poker [a cryptographically secure RNG] is completely unnecessary. If you have an appropriate unpredictable seed, and you are throwing away a lot of ...
8
votes
2answers
6k views

Can the numbers on RSA SecurID tokens be predicted?

My workplace uses these SecurID tokens which provide you with a temporary password, the code will expire after a short time. I have always been fascinated by the things, because it seems as though ...
8
votes
1answer
2k views

Howto seed the PRNG in OpenSSL properly?

I am creating an application which runs on a mobile node with Ubuntu, which does not generate enough entropy bytes to the /dev/random, and does not always stay connected on the Internet to use typical ...
10
votes
5answers
719 views

Should passwords be truly random?

When generating a password, should it be "truly random" or should I make it a little less random by enforcing some rules? If a password is generated at random, it could come out all-lowercase letters ...
8
votes
2answers
538 views

Is a rand from glibc's rand secure for a login key?

Same question as Is a rand from /dev/urandom secure for a login key, but with glibc's rand function instead of /dev/urandom. And what would be a sufficiently secure seed generator?
4
votes
3answers
814 views

Pseudo Random Generator is not initialized from the (entropy pool)?

The RHEL5 manuals state that /dev/urandom will use the entropy pool until it's exhausted, and then it will resort to a fall-back pseudo-random algorithm, so that it will never block. But when ...
1
vote
2answers
616 views

How to generate a highly unpredictable random bytes

void vncRandomBytes(unsigned char *bytes) { int i; unsigned int seed = (unsigned int) time(0) + getpid() + rand(); srand(seed); for (i = 0; i < CHALLENGESIZE; i++) { bytes[i] = (unsigned ...
1
vote
1answer
330 views

What are the requirements for a random number generator to a be safe to use in cryptography?

When I look at most RNG's (random number generators), I see a disclaimer that looks similar to this: Caution: Mersenne Twister is basically for Monte-Carlo simulations - it is not ...