Generating Random and Pseudorandom Numbers

Slides:



Advertisements
Similar presentations
Using random numbers Simulation: accounts for uncertainty: biology (large number of individuals), physics (large number of particles, quantum mechanics),
Advertisements

High Performance Computing 1 Random Numbers. High Performance Computing 1 What is a random number generator? Most random number generators generate a.
Foundations of Cryptography Lecture 10 Lecturer: Moni Naor.
Random Number Generation Graham Netherton Logan Stelly.
Network Security. Confidentiality Using Symmetric Encryption John wrote the letters of the alphabet under the letters in its first lines and tried it.
CS457 – Introduction to Information Systems Security Cryptography 1b Elias Athanasopoulos
History of Random Number Generators Bob De Vivo Probability and Statistics Summer 2005.
Random Numbers. Two Types of Random Numbers 1.True random numbers: True random numbers are generated in non- deterministic ways. They are not predictable.
Computability and Complexity 20-1 Computability and Complexity Andrei Bulatov Random Sources.
Cryptography and Network Security Chapter 7 Fifth Edition by William Stallings Lecture slides by Lawrie Brown.
© 2003 School of Computing, University of Leeds SY32 Secure Computing, Lecture 15 Implementation Flaws Part 3: Randomness and Timing Issues.
Stream cipher diagram + + Recall: One-time pad in Chap. 2.
Using random numbers Simulation: accounts for uncertainty: biology (large number of individuals), physics (large number of particles, quantum mechanics),
Using random numbers Simulation: accounts for uncertainty: biology (large number of individuals), physics (large number of particles, quantum mechanics),
The Problem With The Linpack Benchmark 1.0 Matrix Generator Jack J. Dongarra and Julien Langou International Journal of High Performance Computing Applications.
Genetic Algorithms Can Be Used To Obtain Good Linear Congruential Generators Presented by Ben Sproat.
Pseudorandom Number Generators
Pseudorandom Bit Generation Artur Gadomski Piero Giammarino Henrik Goldman Massimo Giulio Caterino.
Cryptography and Network Security Chapter 7
15-853Page :Algorithms in the Real World Generating Random and Pseudorandom Numbers.
Random Number Generation Fall 2013
Pseudorandom Number Generators. Randomness and Security Many cryptographic protocols require the parties to generate random numbers. All the hashing algorithms.
Entropy of Keys and Password Generation Introduction to entropy Entropy and data compression Predictability of random number generation Entropy and system.
Cryptography and Network Security Chapter 7 Fifth Edition by William Stallings Lecture slides by Lawrie Brown.
Pseudo-random Number Generation Qiuliang Tang. Random Numbers in Cryptography ► The keystream in the one-time pad ► The secret key in the DES encryption.
Cryptography and Network Security Chapter 7 Fifth Edition by William Stallings.
Cryptography and Network Security (CS435)
Random Numbers CSE 331 Section 2 James Daly. Randomness Most algorithms we’ve talked about have been deterministic The same inputs always give the same.
CS 521 Computational Science 1 Random Numbers and Monte Carlo Methods Charles Erwin and Jay Hatcher.
Random-Number Generation Andy Wang CIS Computer Systems Performance Analysis.
Chapter 7 Random-Number Generation
Information Security Lab. Dept. of Computer Engineering 182/203 PART I Symmetric Ciphers CHAPTER 7 Confidentiality Using Symmetric Encryption 7.1 Placement.
Random Number Generators 1. Random number generation is a method of producing a sequence of numbers that lack any discernible pattern. Random Number Generators.
Pseudo-random generators Random Number Generating There are three types of generators table look-up generators hardware generators algorithmic (software)
Monte Carlo Methods.
Chapter 7 – Confidentiality Using Symmetric Encryption.
Chapter 7 Confidentiality Using Symmetric Encryption.
Cryptography and Network Security Key Distribution for Symmetric Encryption.
Attacks on PRNGs - By Nupura Neurgaonkar CS-265 (Prof. Mark Stamp)
Network Security Lecture 18 Presented by: Dr. Munam Ali Shah.
Pseudorandom numbers John von Neumann: Any one who considers
Fall 2006CS 395: Computer Security1 Confidentiality Using Symmetric Encryption.
The man who knew 28% of mathematics. John Von Neumann ( ) Hans Bethe: Academic seminars (10.
Chapter 7 – Confidentiality Using Symmetric Encryption.
1.  How does the computer generate observations from various distributions specified after input analysis?  There are two main components to the generation.
Sampling and Sampling Distributions
Issues of Random Numbers and Cryptography
3. Random Number Generator
Generating Random Numbers
Network Traffic Randomness for Cryptographic Purposes
Chapter 7: Confidentiality Using Symmetric Encryption
Modeling and Simulation CS 313
Random Number Generators
A cryptographically secure pseudorandom number generator for Julia
Random Number Generation
Random-Number Generation
CS 475/575 Slide set 4 M. Overstreet Old Dominion University
Chapter 7 Random-Number Generation
Properties of Random Numbers
Analysis of the RSA Encryption Algorithm
Lecture 2 – Monte Carlo method in finance
Modeling and Simulation CS 313
Cryptography and Network Security Chapter 7
Validating a Random Number Generator
Pseudorandom number, Universal Hashing, Chaining and Linear-Probing
Computer Simulation Techniques Generating Pseudo-Random Numbers
Random Number Generation
Generating Random and Pseudorandom Numbers
Pseudorandom Numbers Network Security.
Crypto for CTFs.
Presentation transcript:

Generating Random and Pseudorandom Numbers Some slides from CS 15-853:Algorithms in the Real World, Carnegie Mellon University

Random Numbers in the Real World https://fitforrandomness.files.wordpress.com/2010/11/dilbert-does-randomness.jpg https://xkcd.com/221/

Random number sequence definitions Each element is chosen independently from a probability distribution [Knuth]. Randomness of a sequence is the Kolmogorov complexity of the sequence (size of smallest Turing machine that generates the sequence) – infinite sequence should require infinite size Turing machine.

Environmental Sources of Randomness Radioactive decay http://www.fourmilab.ch/hotbits/ Radio frequency noise http://www.random.org Noise generated by a resistor or diode. Canada http://www.tundra.com/ (find the data encryption section, then look under RBG1210. My device is an NM810 which is 2?8? RBG1210s on a PC card) Colorado http://www.comscire.com/ Holland http://valley.interact.nl/av/com/orion/home.html Sweden http://www.protego.se Inter-keyboard timings (watch out for buffering) Inter-interrupt timings (for some interrupts)

Combining Sources of Randomness Suppose r1, r2, …, rk are random numbers from different sources. E.g., r1 = from JPEG file r2 = sample of hip-hop music on radio r3 = clock on computer b = r1  r2  …  rk If any one of r1, r2, …, rk is truly random, then so is b.

Skew Correction Von Neumann’s algorithm – converts biased random bits to unbiased random bits: Collect two random bits. Discard if they are identical. Otherwise, use first bit. Efficiency?

Chi Square Test Experiment with k outcomes, performed n times. p1, …, pk denote probability of each outcome Y1, …, Yk denote number of times each outcome occured Large X2 indicates deviance from random chance

Analysis of random.org numbers John Walker’s Ent program Entropy = 7.999805 bits per character. Optimum compression would reduce the size of this 1048576 character file by 0 percent. Chi square distribution for 1048576 samples is 283.61, and randomly would exceed this value 25.00 percent of the times. Arithmetic mean value of data bytes is 127.46 (127.5 = random). Monte Carlo value for PI is 3.138961792 (error 0.08 percent). Serial correlation coefficient is 0.000417 (totally uncorrelated = 0.0

Analysis of JPEG file Entropy = 7.980627 bits per character. Optimum compression would reduce the size of this 51768 character file by 0 percent. Chi square distribution for 51768 samples is 1542.26, and randomly would exceed this value 0.01 percent of the times. Arithmetic mean value of data bytes is 125.93 (127.5 = random). Monte Carlo value for Pi is 3.169834647 (error 0.90 percent). Serial correlation coefficient is 0.004249 (totally uncorrelated = 0.0).

Pseudorandom Number Generators A pseudorandom number generator (PRNG) is an algorithm for generating a sequence of numbers whose properties approximate the properties of sequences of random numbers. The PRNG-generated sequence is not truly random, because it is completely determined by an initial value, called the PRNG's seed (which may include truly random values). Although sequences that are closer to truly random can be generated using hardware random number generators, pseudorandom number generators are important in practice for their speed and reproducibility.

Pseudorandom Number Generators PRNGs are central in applications such as simulations (e.g. for the Monte Carlo method), electronic games (e.g. for procedural generation), and cryptography. Cryptographic applications require the output not to be predictable from earlier outputs. “Anyone who considers arithmetical methods of producing random digits is, of course, in a state of sin.” - John Von Neumann, 1951

Simple Visual Test Create a visualization of the consecutive tuples of numbers it produces. Humans are really good at spotting patterns.

Linear Congruential Generator (LCG) x0 = given, x n+1 = P1 xn + P2   (mod N)    n = 0,1,2,...     (*) x 0 =79, N = 100, P 1 = 263, and P 2 = 71 x1 = 79*263 + 71 (mod 100) = 20848 (mod 100) = 48, x2 = 48*263 + 71 (mod 100) = 12695 (mod 100) = 95, x3 = 95*263 + 71 (mod 100) = 25056 (mod 100) = 56, x4 = 56*263 + 71 (mod 100) = 14799 (mod 100) = 99, Sequence: 79, 48, 95, 56, 99, 8, 75, 96, 68, 36, 39, 28, 35, 76, 59, 88, 15, 16, 79, 48, 95 Park and Miller: P1 = 16807, P2 = 0, N= 231-1 = 2147483647, x0 = 1. ANSI C rand(): P1 = 1103515245, P2 = 12345, N = 231, x0 = 12345

Example Comparison

Plot (xi, xi+1)

Plot (xi, xi+1) Park and Miller

(xi, xi+1), (xi,xi+2), (xi, xi+2) http://www.math.utah.edu/~alfeld/Random/Random.html

Visual Test in 3D Three-dimensional plot of 100,000 values generated with IBM RANDU routine. Each point represents 3 consecutive pseudorandom values. It is clearly seen that the points fall in 15 two-dimensional planes.

Matsumoto’s Marsenne Twister Considered one of the best linear congruential generators. http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html

Example Visual Test

Cryptographically Strong Pseudorandom Number Generator Next-bit test: Given a sequence of bits x1, x2, …, xk, there is no polynomial time algorithm to generate xk+1. Yao [1982]: A sequence that passes the next-bit test passes all other polynomial-time statistical tests for randomness.

Hash/Encryption Chains Last bit of xi+1 Hash or Encryption Function key xi+1 xi (need a random seed x0 or key value)

Some Encryption and Hash Functions SHA-1 Hash function https://en.wikipedia.org/wiki/SHA-1 MD5 Hash function https://en.wikipedia.org/wiki/MD5 Data Encryption Standard (DES) https://en.wikipedia.org/wiki/Data_Encryption_Standard Advanced Encryption Standard (AES) https://en.wikipedia.org/wiki/Advanced_Encryption_Standard

BBS “secure” random bits BBS (Blum, Blum and Shub, 1984) Based on difficulty of factoring, or finding square roots modulo n = pq. Fixed p and q are primes such that p = q = 3 (mod 4) n = pq (is called a Blum integer) For a particular bit seq. Seed: random x relatively prime to n. Initial state: x0 = x2 ith state: xi = (xi-1)2 ith bit: lsb of xi Note that: Therefore knowing p and q allows us to find x0 from xi