Questions tagged [random-number-generator]

A random number generator is a software or hardware solution which functions as a generator of (real or pseudo) random numbers (or bits).

Filter by
Sorted by
Tagged with
12 votes
1 answer
3k views

How much entropy is lost via hashing when you add known or low entropy data?

(I updated the title, as I think there was some confusion as to the question) Here's the question: For example, if I have a bit stream that is 64K bytes long and there is about 16 *8 bits worth of ...
Blaze's user avatar
  • 551
12 votes
3 answers
2k views

How broken is a xor of two LCGs?

Suppose we define a PRG as the xor of two LCGs modulo a 64-bit prime: something like the following Python code. ...
Robin Houston's user avatar
12 votes
2 answers
10k views

Using a Hash as a secure PRNG

I was just looking at some NIST PRNG recommendations, specifically at Hash_DRBG. I read briefly through the algorithm, and even though it is not overly complex, it still seems unnecessary to me. I ...
cooky451's user avatar
  • 345
12 votes
1 answer
6k views

Cryptographic security of PHP mt_rand() function using Mersenne Twister algo

At StackOverflow, this question has been asked. It uses additional random entropy and a hash method (among others) to try and create a cryptographically secure pseudo-random number generator for PHP. ...
Maarten Bodewes's user avatar
  • 92.6k
12 votes
2 answers
2k views

Dice vs quantum random number generator

I recently championed quantum key distribution networks. This has led me to also question quantum random number generators. It appears that randomness is randomness, even if made by custom quantum ...
Paul Uszak's user avatar
  • 15.4k
12 votes
3 answers
16k views

How vulnerable is the C rand() in public cryptography protocols?

I just learned about the basics of public cryptography a few weeks ago and I am curious as to why the C rand() function should not be used for crypto schemes. For example, say I want to generate a ...
jeffrey's user avatar
  • 221
12 votes
1 answer
6k views

Technical details of attack on Android bitcoin usage of SecureRandom

Reports are surfacing that Android's Java SecureRandom class has issues and isn't totally secure. A specific example of how this issue translates to applications is bitcoin, where reports are stating ...
makerofthings7's user avatar
11 votes
5 answers
4k views

Radioactive Decay, Gaussian or Uniform?

I'm trying to understand the nature of true randomness. I'm building an RNG using a radioactive source. Basically, I'm measuring the time between consecutive decays which in theory should be ...
rdkylp's user avatar
  • 111
11 votes
3 answers
5k views

How to evaluate chi squared result?

I've been recently working on a (supposedly) TRNG. I'm still at the beginning of the project, so it is certainly not cryptographically secure yet, for now I'm just playing around. In fact, I've ...
valerio_new's user avatar
11 votes
3 answers
2k views

Initialize a PRNG with a password

Let's assume that we have a secure PRNG. Is it "safe" to initialize it with password, or seed based on a password like SHA256(password)? If yes, is it "safe" to generate an RSA or DSA key from it? ...
esskar's user avatar
  • 373
11 votes
5 answers
8k views

How does generating random numbers "remove entropy from your system"?

In a previous question, I quoted the --gen-random entry in the GPG Man Pages. At the end it says: PLEASE, don’t use this command unless you know what you are ...
camercu's user avatar
  • 333
11 votes
3 answers
5k views

Usage difference between x86 RDRAND and RDSEED

Modern x86 CPUs often have the RDRAND and RDSEED instructions for hardware generation of random numbers. I just don't understand the difference between them. Intel has this document: https://...
Myria's user avatar
  • 2,575
11 votes
2 answers
1k views

Definition of a CSPRNG

I am interested in what conditions are necessary and sufficient to define a cryptographically secure pseudo-random number generator (CSPRNG). Wikipedia lists two defining characteristics: It ...
Dave White's user avatar
11 votes
1 answer
7k views

Correct way to map random number to defined range?

Say that we have a secure random number generation that outputs 32 bit random numbers, so it's output is a true random number between 0 and a MAX. What is the best way to map this random number to a ...
AndroidSec's user avatar
11 votes
1 answer
2k views

What are the methods to construct a primitive binary nonlinear feedback shift register (NLFSR)?

Given a binary shift register of $n$ bits, a primitive binary nonlinear feedback shift register will generate a sequence with a period of $2^n - 1$. While I am unable to find a paper which directly ...
Bluemilk's user avatar
  • 211
11 votes
1 answer
472 views

How to tell if a hardware RNG is rigged?

On a related note of building my own RNG, as someone suggested to use several commericial solutions how can I check if it is rigged against me? (although I am still strongly biased to a homebrew ...
Maxthon Chan's user avatar
11 votes
2 answers
1k views

Shared secret: Generating Random Permutation

-- or: How to Play Poker Without a Dealer I know this question is long but it's a really interesting theoretical problem about shared secrets and multi-party computation. General Problem: "Shared ...
leemes's user avatar
  • 213
11 votes
0 answers
687 views

What level of security is provided when a Feistel Cipher is used as a round function of another Feistel Cipher?

Recently, I was reading: Are there any specific requirements for the function F in a Feistel cipher?, and the answer posted mentions a Feistel Cipher named Turtle, which uses a four-round Feistel ...
user avatar
10 votes
3 answers
7k views

How to generate a list of unique random strings?

How would you generate a list of distinct random strings, where all strings are alphanumeric and have a fixed length?
Micky W.'s user avatar
  • 111
10 votes
3 answers
4k views

Is a die implemented in a physics engine truly random?

So, a fair die throw is really random, not pseudo. So, would a RNG implemented as the result of a die throw in a physics engine (say, Newton, Havok, Nvidia's PhysX) be regarded as both ...
ppp's user avatar
  • 203
10 votes
2 answers
10k views

Estimating bits of entropy

I know there are different statistical tests out there (NIST, Dieharder, etc), which all do different ways of analyzing entropy. What I'm having a hard time finding is any particular literature ...
Blaze's user avatar
  • 551
10 votes
4 answers
5k views

If I am about to generate one-time pad, where should I generate my pads from?

If I want to generate a few one-time pads, is it OK to just read required number of bytes from /dev/urandom without weakening information-theoretical security?
assp1r1n3's user avatar
  • 111
10 votes
2 answers
1k views

Does an encrypted random sequence conserve its "randomness"?

If you have a random uniform sequence of bits $A$ generated by a TRNG with good performance of randomness tests (eg Dieharder, NIST, Kolmogorov complexity, chi-square, etc) and perform an encryption (...
Victor's user avatar
  • 265
10 votes
4 answers
4k views

Predicting PRNG given some of its previous output

I a have a question about PRNGs and this is my very first experience with them. I have the following generator that takes a 56-bit seed $p$ during initialization and then chooses both $X$ and $Y$ ...
Samer Makary's user avatar
10 votes
2 answers
4k views

Does Microsoft use Dual_EC_DRBG by default?

So, as we all know, Dual_EC_DRBG contains an NSA back door. At this point, there is no reason to call it a "potential" or even an "alleged" back door; the presence is obvious even to the NY Times. As ...
Nemo's user avatar
  • 1,377
10 votes
3 answers
1k views

Perfect shuffle possible with limited raw entropy?

I am trying to shuffle a standard 52-card deck in a perfect way (every outcome should be possible at an equal chance). I am not, at this point, concerned with cryptanalysis attacks against it. I have ...
RokL's user avatar
  • 211
10 votes
3 answers
403 views

Does chaining random number generators lead to loss of randomness?

Assume you chain random number generators, i.e use the result of one PRNG as the seed for the next. What kind of errors can that introduce in the randomness of the numbers generated?
Inemesit Affia's user avatar
10 votes
1 answer
764 views

Can reduced-round ChaCha be used as non-cryptographic fast PRNG to produce output indistinguishable from random data?

The fastest known attack against the Salsa20 family of stream ciphers requires 2137 simple operations against Salsa20/7, or 2244 against Salsa20/8. The 8-round version encrypts data at 1.88 cycles-per-...
forest's user avatar
  • 15.3k
10 votes
3 answers
2k views

Will X9.31 remain a secure & acceptable deterministic random generator beyond 2015?

I am actually looking for available crypto libraries including a deterministic random generator for the purpose of a dedicated crypto key generator unit. I have a simple question about the X9.31 based ...
william_fr's user avatar
10 votes
2 answers
10k views

Good entropy source for generating openssl keys

I need to generate a CA (4096-bit RSA) and server keys for openvpn and I want them to be "top quality". Here is my plan: gather entropy from multiple sources (saving individual files): FreeBSD Yarrow,...
Vincent's user avatar
  • 101
10 votes
1 answer
1k views

How distinct are the meanings of the terms "CSPRNG," "DRBG" and "stream cipher"?

Are there universal, consensus definitions for the following terms? Cryptographically secure pseudo-random number generator ("CSPRNG") Deterministic random bit generator ("DRBG") Stream cipher This ...
Luis Casillas's user avatar
10 votes
1 answer
1k views

Distributed generation of random numbers

I have a network of $N \gg 1$ nodes. Some relatively low fraction $p$ (e.g., $p \simeq 0.01$) of them is under the control of a malicious attacker. Nodes can talk to each others and verify each other'...
Matteo Monti's user avatar
  • 1,407
10 votes
1 answer
4k views

What should be used as a source for entropy?

I have hardware-based RNG which consists of TRNG and PRNG. TRNG is giving out a 512-bit number which is being used as a seed for PRNG. RNG is generating a 160-bit random number using PRNG and ...
user2363993's user avatar
10 votes
3 answers
715 views

Is it possible to determine or estimate the period for Blum-Micali PRG?

The Blum-Micali is a cryptographically secure pseudorandom number generator. The construction (from wikipedia): Let $p$ be an odd prime, and let $g$ be a primitive root modulo $p$. Let $x_0$ be a ...
tingnin's user avatar
  • 201
9 votes
2 answers
2k views

How feasible would it be to generate 300 million public key pairs in 8 hours?

Assume there is a hypothetical situation where one would need to generate hundreds of millions of public key pairs of reasonable strength in a limited time. What would be required in terms of ...
Huckle's user avatar
  • 298
9 votes
1 answer
1k views

Why does BCRYPT_RNG_DUAL_EC_ALGORITHM get removed from CNG API on Windows 10?

On article at => Microsoft Docs CNG Algorithm Identifiers I notice that BCRYPT_RNG_DUAL_EC_ALGORITHM is now removed since Windows 10. Beginning with Windows ...
sandthorn's user avatar
  • 193
9 votes
3 answers
2k views

HRNG for One Time Pad

I have just advanced to the last grade of high school (in Denmark). In this year, we all get to do one big project, where we can build/invent/create whatever we want to "solve a problem". As I study ...
Janman's user avatar
  • 335
9 votes
3 answers
1k views

Is there some way to generate a non-predictable random number in a decentralised network?

Is there a way to generate a random number with given restrictions: It will be used in a decentralised network with a big number of peers (no central authority to generate it) Its generation should ...
ThePiachu's user avatar
  • 1,679
9 votes
2 answers
3k views

Extracting randomness from highly-biased RNG

I have a source with a very low entropy (like 3 entropy bits per 1024 source bits). But I need to construct a 128 bit seed from the source. Will it be helpful to XOR 350 bits with jump 128 bits, e.g....
Kesha's user avatar
  • 365
9 votes
1 answer
7k views

Generating Random Primes

Although this has been extensively discussed around here, I'm curious whether my approach makes sense, or I should just stick to "the standard version". I'm implementing some homomorphic encryption ...
Mihai Todor's user avatar
9 votes
2 answers
2k views

Trial divisions before Miller-Rabin checks?

I'm trying to understand prime number generation (more correctly, the primality checking) as described in Handbook of Applied Cryptography. The context is circa pages 145 - 150, and specifically ...
user avatar
9 votes
1 answer
2k views

"Seed" vs "seed key"

The FIPS 140-2 Derived Test Requirements has a statement: AS07.09: (Levels 1, 2, 3, and 4) The seed and seed key shall not have the same value. What is the difference between a seed and a "seed ...
Dan Bossler's user avatar
9 votes
1 answer
2k views

Introduction to LLL algorithm applied to linear modular inequalities

What is the Lenstra–Lenstra–Lovász lattice basis reduction algorithm about? How is it applied to solve for $x\pmod m$ a system of modular inequalities $(u_i\,x+v_i\bmod m)<w$ for $0\le i<n$? I'm ...
fgrieu's user avatar
  • 141k
9 votes
1 answer
5k views

Is SHA-1 secure when used to implement a PRNG

I read SHA-1 is still a secured hashing function with no collision found as of now. However, it's just a matter of time for someone to come up with such a collision or attack. Therefore, in new ...
Saptarshi Basu's user avatar
9 votes
1 answer
9k views

LFSR get output from characteristic polynomial?

Say you have a characteristic polynomial of an LFSR: $$f(X) = X^4 + X^3 + 1$$ How can I use this function f to get the output of the LFSR, given some initial state? Obviously I can create the LFSR ...
AttributedTensorField's user avatar
9 votes
3 answers
2k views

Deterministically combine more than one source of entropy

What is the proper/canonical way to do this? For example, $0 < r1 < 1$ and $0 < r2 < 1$. Presuming uniformly distributed probabilities for the two, combining/averaging them is going to ...
Shad's user avatar
  • 283
8 votes
11 answers
5k views

Algorithm: How to use x and y mouse movement co-ordinates to generate random data?

Background: I'm making a program for fun as a learning exercise. I want to generate some actual random key material (not pseudorandom) from a JavaScript program. For my program is just for encrypting/...
zuallauz's user avatar
  • 314
8 votes
2 answers
13k views

How to find generator $g$ in a cyclic group?

As generator $g$ is used in DH how do you find a combination of prime $p$ and $g$? eg: if we choose $p=23$ and its generator is $7$ (given in the book) how do we find the generator?
user7447's user avatar
8 votes
1 answer
911 views

RFC6979: error in reference implementation?

If I correctly understand RFC 6979, there is an error in the ref implementation section 3.2. In the step H2, RFC specification says ...
cslashm's user avatar
  • 413
8 votes
4 answers
278 views

Why are $\lceil 1/\operatorname{entropy-per-bit} \rceil$ number of bits not sufficient to generate an unbiased bit?

Consider a biased RNG badrand() generating 1 with probability $0.9$ and 0 with probability $...
Ritesh Singh's user avatar

1
2
3 4 5
17