0
$\begingroup$

How is the seed of PRNGs generated? They can't be hardcoded I am guessing.

$\endgroup$
1
  • 1
    $\begingroup$ That depends on how important the randomness is. If you use randomness to simulate some statistical experiment, it need not be cryptographically secure as long as the "randomness" has the distribution you want. For cryptographic purposes it it should be as close to uniform and unpredictable as possible. If you're looking for ways to do that, then this might be of interest to you: cloudflare.com/learning/ssl/lava-lamp-encryption $\endgroup$ Sep 7, 2022 at 12:53

1 Answer 1

2
$\begingroup$

Absolutely not acceptable to "hard-wire".

A PRNG must have a purely random seed. Ideally that seed should come from non-repeatable physical sources and have uniform distribution with independent symbols.

The seed is the only random part of a PRNG, the rest is purely deterministic.

More on the definition below:

Formal definition PRNG

This may present some practical difficulties, one solution may be to pool a number of randomness sources as described below:

Random Number Generation with a Entropy pool versus Seed

$\endgroup$
2
  • $\begingroup$ How is it implemented in JavaScript? From what I know, JavaScript is quite far from the hardware compared to C/C++ $\endgroup$ Sep 7, 2022 at 12:11
  • $\begingroup$ @CipherNewbie in JavaScript crypto.getRandomValues() is usually implemented in C/C++ as a pass-through to the OS secure random number generator. On Windows, Linux, or most other OS this is generally a fast CSPRNG seeded by an “entropy pool” which collects system interrupt timings and other unpredictable events. $\endgroup$
    – rmalayter
    Sep 14, 2022 at 2:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.