cmsc142 - yimg.com

rucksackbulgeΤεχνίτη Νοημοσύνη και Ρομποτική

1 Δεκ 2013 (πριν από 3 χρόνια και 11 μήνες)

117 εμφανίσεις

The Shrinking Rule 30 Cellular
Automata Pseudorandom
Number Generator

University of the Philippines Cebu

Department of Computer Science

Cmsc142, Cmsc190, Cmsc199

Nico Martin A. Eñego

February 12, 2011

February 12, 2011

The Shrinking Rule 30 Cellular Automata
Pseudorandom Number Generator

2

Outline


Randomness: What is it?


History


True Randomness vs. Pseudo randomness


Rule 30 Cellular Automata RNG


Problems with R30


The Problem and The Literature Trend


Shrinking Rule 30 Cellular Automata RNG


Methodology


Expected Results


Recommendations


Q&A


References

February 12, 2011

The Shrinking Rule 30 Cellular Automata
Pseudorandom Number Generator

3

Conceptual Framework

Random Numbers

PRNGs

Shrinking Rule 30 CA PRNG

Rule 30

CA PRNG

February 12, 2011

The Shrinking Rule 30 Cellular Automata
Pseudorandom Number Generator

4

Randomness: What is it?


Random number generators (RNGs) have a
myriad of
real world applications


games, experiments and statistics, gambling,
simulations, random search optimization etc.


There is a need of a
better

random number
source for specific uses (more random,
efficiency, size)


Cryptology, security and


online gambling

February 12, 2011

The Shrinking Rule 30 Cellular Automata
Pseudorandom Number Generator

5

Randomness: What is it?


Some concepts: sporadic, irregular,
nonuniform, a/periodic, Pattern?


How do we prove randomness when an exact
universal definition is missing?

February 12, 2011

The Shrinking Rule 30 Cellular Automata
Pseudorandom Number Generator

6

Randomness: What is it?


What is more random, 9898 or 7878?


Philosophical question
:

Physical phenomena

(coin flipping, noise) are said

to be random, but…

“God does NOT play dice

with the universe.”

-
Albert Einstein


Is the universe deterministic?

February 12, 2011

The Shrinking Rule 30 Cellular Automata
Pseudorandom Number Generator

7

History of RNG


1941: ATT Machine
generating random
sequence


1946: Table of random
numbers by Tippet and
von Neumann’s
Middle
Square Approach


1951: Lehmer’s
Congruential Generator


February 12, 2011

The Shrinking Rule 30 Cellular Automata
Pseudorandom Number Generator

8

int msa( int s, int d ){


square s; //s must be d
-
digit int


return middle d
-
digits;

}

History of RNG

Middle Square Approach

by von Neumann:





Example: Suppose we want 5 digit numbers
and start with
12345
. Then,
(12345)
2

=
15
23990
25 and the next number is
23990


February 12, 2011

The Shrinking Rule 30 Cellular Automata
Pseudorandom Number Generator

9

History of RNG

Lehmer’s Congruential Generator:

m = 31, a = 3, c = 0, x
0
= 9.




Solution: 27; 19; 26; 16; 17; 20; 29; 25; 13; 8;
24; 10; 30; 28; 22; 4; 12; 5; 15; 14; 11; 2; 6;
18; 23; 7; 21; 1; 3; 9 (at which point series
repeats)

x
i

= (3
Xi
-
1
) mod 31

February 12, 2011

The Shrinking Rule 30 Cellular Automata
Pseudorandom Number Generator

10

History of RNG


Lehmer’s congruential
generator is also known
as
linear congruential
generator


Not so random!


Quadratic Congruential
Generators


Short periods


occupies much space



February 12, 2011

The Shrinking Rule 30 Cellular Automata
Pseudorandom Number Generator

11

History of RNG


Linear Feedback Shift Registers:





Example:

Take p = 5; q = 2; r = 3 and b
1

= b
2

= b
3

= b
4

=
b
5

= 1. So, b
i

= b
i
-
5

XOR b
i
-
3

produces

b
6

= b
1

XOR b
3

= 1 XOR 1 = 0

b
7

= b
2

XOR b
4

= 1 XOR 1 = 0

Suppose that r
-
bit integers are to be generated. Then,
for some integer p, start with a p
-
bit seed of the binary
form b
1
…b
p

with the b
i

all being 0 or 1. Subsequent bit
values are produced via the recursion

b
i

= b
i
-
p

XOR b
i
-
p+q

February 12, 2011

The Shrinking Rule 30 Cellular Automata
Pseudorandom Number Generator

12

History of RNG


Cellular Automata
Generators (1985):


Originates from simple
rules


Very large periods


Chaotic behavior


February 12, 2011

The Shrinking Rule 30 Cellular Automata
Pseudorandom Number Generator

13

Randomness: TRN vs PRN


Coin Flipping: Truly random or difficult
-
to
-
describe system?


Simka et al. (2006): Randomness appears in
the “instability” of the system.


Two types of random number generators


Truly Random Number Generator (TRNG):
generates Truly random numbers (TRNs)


Pseudo Random Number Generator (PRNG):
generates pseudo random numbers (PRNs)

February 12, 2011

The Shrinking Rule 30 Cellular Automata
Pseudorandom Number Generator

14

Randomness: TRN vs PRN



Truly random number (TRN):


Cannot be subsequentially reliably reproduced
(nondeterministic)


Unrepeatable even with same working conditions
(aperiodic)


Needs external
physical phenomena

(inefficient)


Pseudo
-
random number (PRN) is a number
that is generated by and
algorithm

or a
pre
-
calculated table of values


Deterministic, periodic, efficient

February 12, 2011

The Shrinking Rule 30 Cellular Automata
Pseudorandom Number Generator

15

Randomness: TRN vs PRN


TRN and PRN are both widely used today


There are a lot of TRN sources (lava lamp)


For some applications, PRNG are more
reasonable because of their
properties


A good PRNG usually needs a
random


seed

which would be good if it


comes from a TRNG


(Hybrid generator)

February 12, 2011

The Shrinking Rule 30 Cellular Automata
Pseudorandom Number Generator

16

Conceptual Framework

Random Numbers

PRNGs

Shrinking Rule 30 CA PRNG

Rule 30

CA PRNG

February 12, 2011

The Shrinking Rule 30 Cellular Automata
Pseudorandom Number Generator

17

Rule 30 CA PRNG


Introduced by S. Wolfram in 1983 & 1987


It is a class III rule:
chaotic

and
aperiodic





x(n+1,i) = x(n,i
-
1)
XOR


[x(n,i)
OR

x(n,i+1)].


February 12, 2011

The Shrinking Rule 30 Cellular Automata
Pseudorandom Number Generator

18

February 12, 2011

The Shrinking Rule 30 Cellular Automata
Pseudorandom Number Generator

19

February 12, 2011

The Shrinking Rule 30 Cellular Automata
Pseudorandom Number Generator

20

Rule 30 CA PRNG


RNG used in Mathematica


2
n

repetition: insignificant according to
Andersson (2003)

function rule30CAPRNG(time seed, int n){


evolve seed n times;


take middle bits of each evolution;


}

February 12, 2011

The Shrinking Rule 30 Cellular Automata
Pseudorandom Number Generator

21

The Problem and The Literature Trend


It is possible to crack Rule 30 CA


Meier
-
Staffelbach (1998) Attack


Completion backwards


Completion forwards


Requires lots of resources (but possible)

February 12, 2011

The Shrinking Rule 30 Cellular Automata
Pseudorandom Number Generator

22

The Problem and The Literature Trend


A Rule 30 CA based PRNG that can
counter

the Meier
-
Staffelbach Attack


PRNG that passes
statistical test suite

for
randomness


PRNG that generates more randomness
compared to other PRNGs


Considerable execution time


February 12, 2011

The Shrinking Rule 30 Cellular Automata
Pseudorandom Number Generator

23

The Problem and The Literature Trend

Wolfram’s rule 30
CA PRNG

Rule 30 CA linearity
weaknesses

(Meier and Staffelbach)

Irregular Sampling

(Clark and Essex)

Hybrid CA PRNG

Controllable CA
PRNG

(Guan et al.)

Programmable CA
PRNG

(Nandi et al.)

February 12, 2011

The Shrinking Rule 30 Cellular Automata
Pseudorandom Number Generator

24

Conceptual Framework

Random Numbers

PRNGs

Shrinking Rule 30 CA PRNG

Rule 30

CA PRNG

February 12, 2011

The Shrinking Rule 30 Cellular Automata
Pseudorandom Number Generator

25

Shrinking Rule 30 CA PRNG


The Shrinking Rule 30 CA suggested by
Clark and Essex (2004)

February 12, 2011

The Shrinking Rule 30 Cellular Automata
Pseudorandom Number Generator

26

Shrinking Rule 30 CA PRNG


Important concepts of Clark and Essex model


Storage

requirement is a bit large


Speed

is relatively slower compared to other RNG


Random

and
secure

but not tested


The use of a
non
-
CA controller


Non
-
CA RNG

February 12, 2011

The Shrinking Rule 30 Cellular Automata
Pseudorandom Number Generator

27

Shrinking Rule 30 CA PRNG:
Methodology


Aspects to test:


Intuitive

description of execution time


Statistical tests of randomness and the Avalanche
Effect


Execution times

and
randomness

of different
RNGs will be compared


CPRNG vs. SR30CAPRNG


WR30CAPRNG vs. SR30CAPRNG


CESR30CAPRNG vs. SR30CAPRNG


February 12, 2011

The Shrinking Rule 30 Cellular Automata
Pseudorandom Number Generator

28

Shrinking Rule 30 CA PRNG:
Methodology


Statistical

Test Suite

1.
Frequency or equidistribution test

2.
Serial test

3.
Gap test

4.
Poker test

5.
Coupon collector’s test

6.
Permutation test

7.
Runs up test

8.
Maximum
-
of
-
t test

9.
Avalanche effect

February 12, 2011

The Shrinking Rule 30 Cellular Automata
Pseudorandom Number Generator

29

Shrinking Rule 30 CA PRNG:
Methodology


Intuitive execution time

tests


Attach clock for every program


Generate 1000 integers, 100 runs


Average execution times of all 100 runs


Compare significance of difference using statistics


All programs
implemented

in C


CPRNG implemented using rand()


All programs seeded with time()


February 12, 2011

The Shrinking Rule 30 Cellular Automata
Pseudorandom Number Generator

30

Shrinking Rule 30 CA PRNG:

Expected Results


In terms of
intuitive

execution time
, the
researcher expects the following:


CPRNG < WR30CAPRNG < SR30CAPRNG <
CESR30CAPRNG


In terms of
randomness, security and
avalanche statistics
, the researcher expects
the following:


CPRNG < WR30CAPRNG < CESR30CAPRNG <
SR30CAPRNG

February 12, 2011

The Shrinking Rule 30 Cellular Automata
Pseudorandom Number Generator

31

Shrinking Rule 30 CA PRNG:
Recommendations


Fuse
CCA

and
PCA

concepts with shrinking
generator


Use a
more random

generator (TRNG) for
the seed


Devise a way to
generate small integers


Improve

intuitive execution time tests for
programs to
reflect optimal performance

by
using
parallel programming

(threading) and
dedicated machines

February 12, 2011

The Shrinking Rule 30 Cellular Automata
Pseudorandom Number Generator

32

“We can only see a short distance
ahead, but we can see plenty there
that needs to be done.”


Alan Turing, Father of Computer Science

[p.460 of the Computing Machinery and Intelligence, 1950]

February 12, 2011

The Shrinking Rule 30 Cellular Automata
Pseudorandom Number Generator

33

Q&A

February 12, 2011

The Shrinking Rule 30 Cellular Automata
Pseudorandom Number Generator

34

Thank You!

February 12, 2011

The Shrinking Rule 30 Cellular Automata
Pseudorandom Number Generator

35

References


Lawrence, A.P. (2003) Random Numbers. Available online:
http://aplawrence.com/Basics/randomnumbers.html/ [December 5, 2010]


Park S. and Miller K. (1988) Random Number Generators: Good Ones Are
Hard to Find. Computing Practices. Communications of the ACM, vol. 31,
p. 1192.


Bell, J. Fast Random Numbers. A Random Generator That is 10 Times
Faster. Clinton South Carolina. Volume 8, Issue 3, Column Tag: Coding
Efficiently. Available online:
http://www.mactech.com/articles/mactech/Vol.08/08.03/RandomNumbers/in
dex.html/ [December 5, 2010]


Haahr, M. Random.org. Introduction to Randomness and Random
Numbers. Trinity College, School of Computer Science and Statistics,
Trinity, Ireland. Available online: http://www.random.org/randomness/
[December 5, 2010]


Clark, J. and Essex, A. (2004) Real Time Encryption Using Cellular
Automata. The University of Western Ontario, Department of Electrical and
Computer Engineering. March 26, 2004.


Meier, W. and Staffelbach, O. (1998) Analysis of Pseudo Random
Sequences by Cellular Automata. Springer Verlag. p.186
-
199


Andersson, K. (2003) Cellular Automata. Computer Science, Karlstad
University.