Random Numbers Flashcards
Computing Random Numbers
It is difficult to get a computer to do something by chance; they are deterministic. The same input generates the same output.
Two main approaches for generating random numbers: pseudo RNG and true RNG.
Pseudo Random Number Generators
PRNG uses mathematical formulae to produce sequence of numbers that appear random - but they are not. In reality you are getting the next number from a predetermined list.
PRNG Characteristics
Efficiency - can produce many numbers in short time
Deterministic - a given sequence can be reproduced at a later date if the start point (seed state) is known
Periodic - a sequence of numbers will eventually repeat itself
What is a PRNG suitable for?
Applications where many numbers are required and where it is useful that the same sequence can be replayed easily (for repeated tests, repeated experiments and simulations)
Not suitable for apps where it is important for unpredictable numbers i.e. encryption and gambling.
True Random Number Generator
TRNGs extract randomness from physical phenomena and introduce it into the computing platform.
The phenomena can be simple: little variations in mouse movements, keystroke time etc
Or complex: a radioactive source decaying, atmospheric noise or background noise
TRNG Characteristics
Inefficiency - takes more time to produce numbers
Nondeterministic - given sequence of numbers cannot be reproduced
Aperiodic - a sequence will not repeat unless by chance
What are TRNGs suitable for?
Applications where numbers are unpredictable and random, such as data encryption or gambling
They are less suitable for simulation and modelling applications due to poor efficiency and nondeterminism.
Why are PRNG numbers a security problem?
Cryptographic keys are generated using random number generators; pseudo random numbers are deterministic meaning any sequence of pseudorandom numbers can be reproduced.
Meaning cryptography can be broken and data decrypted!
Secure Random Numbers
A pseudo random number generator that is suitable for cryptographic usage is called a cryptographically secure pseudo RNG - introduce randomness from a high quality source (API)
Properties of a CSPRNG
A CSPRNG will need to exhibit some (or all) of these values:
a) It appears random
b) Its value is unpredictable in advance
c) It cannot be reliably reproduced after generation.