Slide 1

Slide 1 text

No content

Slide 2

Slide 2 text

select a random element

Slide 3

Slide 3 text

select a random element ‘tis one is ok.

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

Information Theory

Slide 7

Slide 7 text

hard TOPIC Information Theory

Slide 8

Slide 8 text

hard TOPIC dumb SPEAKER + Information Theory

Slide 9

Slide 9 text

0≤H(X)≤1 where X is a discrete random variable

Slide 10

Slide 10 text

0≤H(X)≤1 where X is a discrete random variable unpredictable

Slide 11

Slide 11 text

0≤H(X)≤1 where X is a discrete random variable unpredictable always the same

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

ask a question.

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

bool is_random(char *bytes, size_t n) { }

Slide 16

Slide 16 text

bool is_random(char *bytes, size_t n) { } AGHHH

Slide 17

Slide 17 text

UNIFORM distribution

Slide 18

Slide 18 text

UNIFORM distribution

Slide 19

Slide 19 text

select a random element array[rand() % array.size]

Slide 20

Slide 20 text

select a random element array[rand() % array.size] UNIFORM distribution

Slide 21

Slide 21 text

select a random element array[rand() % array.size] UNIFORM distribution

Slide 22

Slide 22 text

select a random element array[rand() % array.size] UNIFORM distribution AGHHH

Slide 23

Slide 23 text

This is how you kill the RANDOM pnrg array

Slide 24

Slide 24 text

This is how you kill the RANDOM a pnrg array

Slide 25

Slide 25 text

This is how you kill the RANDOM a pnrg array

Slide 26

Slide 26 text

This is how you kill the RANDOM a a pnrg array

Slide 27

Slide 27 text

This is how you kill the RANDOM a a pnrg array

Slide 28

Slide 28 text

This is how you kill the RANDOM a a a pnrg array

Slide 29

Slide 29 text

This is how you kill the RANDOM a a a pnrg array

Slide 30

Slide 30 text

This is how you kill the RANDOM a a a pnrg array

Slide 31

Slide 31 text

This is how you kill the RANDOM a a a b pnrg array

Slide 32

Slide 32 text

This is how you kill the RANDOM a a a b pnrg array

Slide 33

Slide 33 text

This is how you kill the RANDOM a a a b b pnrg array

Slide 34

Slide 34 text

This is how you kill the RANDOM a a a b b pnrg array

Slide 35

Slide 35 text

This is how you kill the RANDOM a a a b b pnrg array

Slide 36

Slide 36 text

This is how you kill the RANDOM a a a b b pnrg array

Slide 37

Slide 37 text

how to FIX:

Slide 38

Slide 38 text

how to FIX: 1. Random is hard

Slide 39

Slide 39 text

how to FIX: 1. Random is hard 2. Run away

Slide 40

Slide 40 text

how to FIX: 1. Random is hard 2. Run away Math.random() // between 0.0 and 1.0 Javascript

Slide 41

Slide 41 text

how to FIX: 1. Random is hard 2. Run away

Slide 42

Slide 42 text

how to FIX: 1. Random is hard 2. Run away prng.rand(5..9) #=> one of [5, 6, 7, 8, 9] prng.rand(5...9) #=> one of [5, 6, 7, 8] Ruby

Slide 43

Slide 43 text

Good.

Slide 44

Slide 44 text

Good. (but I don’t care)

Slide 45

Slide 45 text

No content

Slide 46

Slide 46 text

“PRNGs and Hash functions are in the same family of algorithms”

Slide 47

Slide 47 text

No content

Slide 48

Slide 48 text

hash tables out of nowhere!

Slide 49

Slide 49 text

hash tables out of nowhere! O(1)

Slide 50

Slide 50 text

hash tables out of nowhere! O(1) uniform

Slide 51

Slide 51 text

pathological average data set: O(1)

Slide 52

Slide 52 text

pathological average data set: O(1)

Slide 53

Slide 53 text

pathological average data set: O(1) O(n)

Slide 54

Slide 54 text

ONE fix

Slide 55

Slide 55 text

ONE fix INT_MAX % size == 0

Slide 56

Slide 56 text

collide make them

Slide 57

Slide 57 text

collide make them • Brute force

Slide 58

Slide 58 text

collide make them • Brute force • MITM

Slide 59

Slide 59 text

collide make them • Brute force • MITM • Equivalent substrings

Slide 60

Slide 60 text

collide make them • Brute force • MITM • Equivalent substrings

Slide 61

Slide 61 text

collide make them • Brute force • MITM • Equivalent substrings

Slide 62

Slide 62 text

collide make them • Brute force • MITM • Equivalent substrings

Slide 63

Slide 63 text

collide make them • Brute force • MITM • Equivalent substrings

Slide 64

Slide 64 text

collide make them • Brute force • MITM • Equivalent substrings

Slide 65

Slide 65 text

problem & that’s a

Slide 66

Slide 66 text

problem & that’s a painful comparisons

Slide 67

Slide 67 text

problem & that’s a painful comparisons ~700ms responses

Slide 68

Slide 68 text

MANY fixes

Slide 69

Slide 69 text

MANY fixes (but only one is right)

Slide 70

Slide 70 text

MANY fixes (but only one is right) 1. Limiting request size

Slide 71

Slide 71 text

this is bad and you should feel bad! MANY fixes (but only one is right) 1. Limiting request size

Slide 72

Slide 72 text

MANY fixes (but only one is right) 2. Changing the hash table

Slide 73

Slide 73 text

MANY fixes (but only one is right) 2. Changing the hash table (no comment)

Slide 74

Slide 74 text

MANY fixes (but only one is right) 3. Bring back the random

Slide 75

Slide 75 text

No content

Slide 76

Slide 76 text

“Randomness is too important to be left to chance”

Slide 77

Slide 77 text

Thanks. “Randomness is too important to be left to chance”