0% found this document useful (0 votes)
200 views

Csc466/566 Computer Security Midterm Exam Cheat-Sheet

This document contains a cheat sheet for a computer security midterm exam, summarizing key concepts in 3 pages. It covers: 1) Modular arithmetic and basic theorems including Euler's theorem 2) Exponents, logarithms, and the GCD algorithm 3) Public key encryption algorithms like RSA, Elgamal, and Diffie-Hellman key exchange 4) Digital signatures using RSA, Elgamal, and their key generation processes

Uploaded by

Sarang
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
200 views

Csc466/566 Computer Security Midterm Exam Cheat-Sheet

This document contains a cheat sheet for a computer security midterm exam, summarizing key concepts in 3 pages. It covers: 1) Modular arithmetic and basic theorems including Euler's theorem 2) Exponents, logarithms, and the GCD algorithm 3) Public key encryption algorithms like RSA, Elgamal, and Diffie-Hellman key exchange 4) Digital signatures using RSA, Elgamal, and their key generation processes

Uploaded by

Sarang
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

CSc466/566 Computer Security

Midterm Exam Cheat-Sheet


Christian Collberg

Mon Mar 19, 2012

A Cheat-Sheet A.4 Basic Theorems

A.1 Modular Arithmetic Theorem 1 (Euler) Let x be any positive in-


teger that’s relatively prime to the integer n > 0,
then xφ(n) mod n = 1.
(a + b) mod n = ((a mod n) + (b mod n)) mod n
(a − b) mod n = ((a mod n) − (b mod n)) mod n Theorem 2 (Corollary to Euler’s theorem)
(a ∗ b) mod n = ((a mod n) ∗ (b mod n)) mod n Let x be any positive integer that’s relatively
y prime to the integer n > 0, and let k be any posi-
z }| {
y
x mod n = x ∗ x ∗ · · · ∗ x modn tive integer, then xk mod n = xk mod φ(n) mod n.

A.2 Exponents/Powers Theorem 3 (Bezout’s identity) Given any


integers a and b, not both zero, there exist in-
tegers i and j such that GCD(a, b) = ia + jb.
xa xb = x(a+b)
xa y a = (xy)a Theorem 4 (Corollary to Euler’s theorem)
a b (ab) Given two prime numbers p and q, integers
(x ) = x
√ n = pq and 0 < m < n, and an arbi-
x( b ) = b xa
a

trary integer k, then mkφ(n)+1 mod n =


xa mk(p−1)(q−1)+1 mod n = m mod n.
x(a−b) = b
x
1 Theorem 5 (Fermat’s Little Theorem)
x−a = a
x Let p be a prime number and g any positive
integer g < p, then gp−1 mod p = 1.
A.3 Logarithms
A.5 GCD
y = logb (x) iffx = by
logb (1) = 0 f u n c gcd ( i n t a , i n t b ) : ( i n t , i n t , i n t ) =
logb (b) = 1 i f b = 0 then
r e t u r n (a, 1, 0)
logb (xy) = logb (x) + logb (y)
  q ← ⌊a/b⌋
x (d, k, l) ← gcd(b, a mod b)
logb = logb (x) − logb (y)
y r e t u r n (d, l, k − lq)
logb (xn ) = n logb (x)
• Use GCD to compute modular multiplica-
logc (x) tive inverses. Given x < n, we want to
logb (x) = logb (c) logc (x) =
logc (b) compute y = x−1 mod n, i.e. yx mod n =

1
1. The inverse of x in Zn exists when A.8 Elgamal Encryption
GCD(n, x) = 1.
• Bob (Key generation):
• Calculate GCD(n, x) = (1, i, j) such that
1 = ix + jn. Then (ix + jn) mod n = 1. Pick a prime p.
ix mod n = 1 and i is x’s multiplicative in- 2. Find a generator g for Zp .
verse in Zn . 3. Pick a random number x between 1
and p − 2.
4. Compute y = gx mod p.
A.6 RSA
– PB = (p, g, y) is Bob’s RSA public key.
• Bob (Key generation):
– SB = x is Bob’ RSA private key.
1. Generate two large random primes p
and q. • Alice (encrypt and send a message M to
2. Compute n = pq. Bob):
3. Select a small odd integer e relatively 1. Get Bob’s public key PB = (p, g, y).
prime with φ(n). 2. Pick a random number k between 1
4. Compute φ(n) = (p − 1)(q − 1). and p − 2.
5. Compute d = e−1 mod φ(n). 3. Compute the ciphertext C = (a, b):
– PB = (e, n) is Bob’s RSA public key. a = gk mod p
– SB = (d, n) is Bob’ RSA private key.
b = M y k mod p
• Alice (encrypt and send a message M to
• Bob (decrypt a message C = (a, b) received
Bob):
from Alice):
1. Get Bob’s public key PB = (e, n).
1. Compute M = b(ax )−1 mod p.
2. Compute C = M e mod n.
• Bob (decrypt a message C received from Al- A.9 RSA Signature Scheme
ice):
• Bob (Key generation): As before.
1. Compute M = C d mod n.
– PB = (e, n) is Bob’s RSA public key.
– SB = (d, n) is Bob’ RSA private key.
A.7 Diffie-Hellman Key Exchange
• Bob (sign a secret message M ):
1. All parties (set-up):
1. Compute S = M d mod n.
(a) Pick p, a prime number. 2. Send M, S to Alice.
(b) Pick g, a generator for Zp .
• Alice (verify signature S received from
2. Alice: Bob):
(a) Pick a random x ∈ Zp , x > 0. 1. Receive M, S from Alice.
(b) Compute X = gx mod p. ?
2. Verify that M = S e mod n.
(c) Send X to Bob.
3. Bob: A.10 Elgamal Signature Scheme
(a) Pick a random y ∈ Zp , x > 0. • Alice (Key generation): As before.
(b) Compute Y = gy mod p.
1. Pick a prime p.
(c) Send Y to Alice
2. Find a generator g for Zp .
4. Alice computes the secret: K1 = Y x mod p. 3. Pick a random number x between 1
5. Bob computes the secret: K2 = X y mod p. and p − 2.

2
4. Compute y = gx mod p.
– PA = (p, g, y) is Alice’s RSA public
key.
– SA = x is Alice’ RSA private key.
• Alice (sign message M and send to Bob):
1. Pick a random number k.
2. Compute the signature S = (a, b):

a = gk mod p
b = k−1 (M − xa) mod (p − 1)

• Bob (verify the signature S = (a, b) received


from Alice):
?
1. Verify y a · ab mod p = gM mod p.

You might also like