13 Random Number Generation
Hiteishi Diwanji
Blum Blum Shub Generator(Cryptographically secure psuedorandom bit generator):
¨ based on public key algorithms
¨ use least significant bit from iterative equation xi = xi-12 mod n
¨ where n=p.q, and primes p≡q≡3 mod 4
¨ unpredictable, passes next-bit test
¨ security rests on difficulty of factoring n
¨ is unpredictable given any run of bits
¨ slow, since very large numbers must be used
¨ too slow to use for cipher use, good for key generation
Example Blum Blum Shub Generator:
¨ n=192649=383×503
¨ Seed s=101355
i | Xi | Bi |
0 | 20749 | |
1 | 1 | |
143135 | ||
2 | 177671 | 1 |
3 | 97048 | 0 |
Fermat’s Theorem
¨ ap-1 = 1 (mod p)
- ¨ where p is prime and gcd(a,p)=1
- ¨ also ap = p (mod p)
- ¨ useful in public key and primality testing
Euler’s Theorem:
- ¨ a generalisation of Fermat’s Theorem aø(n) = 1 (mod n)
- ¨ for any a,n where gcd(a,n)=1
- ¤ a=3;n=10; ø(10)=4;
hence 34 = 81 = 1 mod 10
- ¤ a=2;n=11; ø(11)=10;
hence 210 = 1024 = 1 mod 11
Primality Testing:
- ¨ divide by all numbers (primes) in turn less than the square root of the number
- ¨ only works for small numbers
- ¨ alternatively can use statistical primality tests based on properties of primes
- 1) for which all primes numbers satisfy property.
- 2) some composite numbers, also satisfy the property.
Miller Rabin Algorithm- a test based on Fermat’s Theorem:
- ¨ algorithm is:
- 1.¤ TEST (n) is:
- Find integers k, q, k > 0, q odd, so that (n–1)=2kq
- Select a random integer a, 1<a<n–1
- if aq mod n = 1 then return (“maybe prime”);
- for j = 0 to k – 1 do
- if (a2jq mod n = n-1)
then return(” maybe prime “)
- return (“composite”)
Applying Miller Rabin Algorithm:
- ¨ n=29
- ¨ n-1=28=22×7=2kqa=10
- ¨ 107 mod 29=17 neither 1 nor 28.
- ¨ (107)2 mod 29=28
- ¨ Returns inconclusive(29 may be prime) Try again a=2
- ¨ 27 mod 29=12 neither 1 nor 28.
- ¨ 214 mod 29=28
- ¨ Returns inconclusive(29 may be prime)
you can view video on Random Number Generation |
Suggested Reading:
- Cryptography and Network Security Principles and Practice by William Stallings, sixth Edition, PEARSON.
- Security in Computing by Charles Pfleeger & Shari Lawrence Pfleeger, fourth Edition, PEARSON.
- Network Security by Charlie Kaufman, Radia Perlman, Mike Speciner, second Edition, PHI.
- The Complete Reference – Network Security by Roberta Bragg, Mark Rhodes-Ousley & Keith Strassberg, Tata McGraw Hill
- Network Security Bible by Eric Cole, Ronald Krutz, James Conley, Wiley
- Hacking 6 Exposed by Stuart McClure, Joel Scambray & George Kurtz , Tata McGraw Hill .
- www.snort.org
- https://nmap.org