Week - 3
Lecture 11:
LFSR based Stream Cipher
LFSR (Linear Feedback Shift Register)
Definition
- A keystream generator used in stream ciphers
- Consists of l-bit shift register + linear feedback (XOR)
Basic Structure
- Bits shift right
- New bit = XOR of selected bits (feedback)
Polynomial Representation
[ 1 + c_1x + c_2x^2 + ... + c_lx^l ]
- If ( c_i = 1 ) → bit participates in feedback
- Defines LFSR structure
Example (4-bit LFSR)
Given
- Initial state: 0110
- Feedback: XOR of 1st & 4th bit
Operation (Steps)
| Round | State | Output |
|---|---|---|
| 0 | 0110 | 1 |
| 1 | 0011 | 0 |
| 2 | 1001 | 1 |
| ... | ... | ... |
- After 15 steps → repeats
- Period = 15 = 2⁴ − 1
Key Observations
- Sequence repeats → periodic
- Max period = ( 2^l - 1 )
- Achieved if polynomial is primitive
Keystream Generation
- Initial state = secret key (α₁, α₂, …, αₗ)
- Future bits = linear combinations of initial key
Problem (Security)
- Output is linear
- Can be expressed as linear equations
- Vulnerable to attacks
Solution → Non-Linear Generators
Idea
- Combine multiple LFSRs
- Use non-linear function (f)
Example: Geffe Generator
- Uses 3 LFSRs
- Output = nonlinear combination
Types of Stream Cipher (LFSR-based)
Synchronized Stream Cipher
-
Keystream depends only on:
- Secret key
-
Independent of plaintext/ciphertext
✔ LFSR belongs here
General Model
- State = ( S_t )
- Update function = ( g )
- Output function = ( h )
Key Takeaways
-
LFSR = fast, simple keystream generator
-
Good randomness if:
- Proper polynomial used
-
Weakness:
- Linear → predictable
-
Solution:
- Use multiple LFSRs + nonlinear functions
Final Conclusion
- LFSR alone is not secure
- Used as building block in modern stream ciphers
Week - 3
Lecture 12:
Mathematical background
Algebra in Cryptography
Motivation
-
Cryptography uses algebraic structures
-
Built on:
- Sets
- Operations (binary operators)
Set (G)
Definition
-
Collection of distinct elements
-
Example:
- Integers: ( )
- Rational:
- Real:
Binary Operation
- Operation on two elements: [ a \cdot b,; a + b,; a \times b ]
Algebraic Properties
1. Closure
[ a \cdot b \in G \quad \forall a,b \in G ]
2. Associativity
[ (a \cdot b)\cdot c = a \cdot (b \cdot c) ]
Semigroup
-
If a set satisfies:
- Closure
- Associativity
→ Called Semigroup
Group
Additional Properties
3. Identity Element
[ a \cdot e = a \quad \forall a \in G ]
4. Inverse Element
[ a \cdot b = e ]
→ Every element must have an inverse
Examples
1. Natural Numbers (N, +)
- ❌ Not a group
- No identity (0 not included)
2. Positive Integers (+)
- ❌ Not a group
- No inverse (e.g., 2 → no -2)
3. Integers (Z, +)
- ✅ Group
- Identity = 0
- Inverse exists
4. Integers (Z, ×)
- ❌ Not a group
- Inverse (1/3) not in Z
5. Rational Numbers (Q, ×)
- ✅ Group
- Inverse exists (1/x)
6. Real Numbers (R, ×)
- ✅ Group
Abelian Group
Definition
[ a \cdot b = b \cdot a ]
- Operation is commutative
Cyclic Group
Definition
-
Group generated by a single element a
-
Every element can be written as:
Important Relations
Key Properties
- Cyclic groups are always Abelian
- Widely used in cryptography
Final Takeaway
-
Cryptography relies on:
- Groups
- Cyclic structures
-
These form the base of:
- RSA
- Diffie-Hellman
- ECC
Week - 3
Lecture 13:
Abstract algebra (Contd.)
Subgroup
Definition
- Let ( G ) be a group and ( )
- If ( H ) itself forms a group under same operation, then ( H ) is a subgroup
Cyclic Subgroup
-
Generated by element ( a ):
-
Eventually:
-
( n ) = order of subgroup
-
Order of subgroup divides order of group
Ring (R)
Definition
A set ( R ) with two operations (+, ·) is a ring if:
Properties
1. Abelian Group under Addition
- Closure
- Associativity
- Identity (0)
- Inverse
- Commutative
2. Closure under Multiplication
3. Associativity (Multiplication)
4. Distributive Law
Examples of Ring
- Integers ( ) → Ring
- Real numbers ( ) → Ring
Commutative Ring
- If:
→ Called Commutative Ring
Integral Domain
Definition
- A commutative ring with:
1. No Zero Divisors
Field
Definition
- A field is an integral domain where:
1. Every non-zero element has multiplicative inverse
Properties
- Abelian under addition
- Commutative multiplication
- Distributive law
Examples of Field
- Real numbers ( ) → Infinite field
- Rational numbers ( ) → Field
Key Takeaways
- Subgroup → subset forming group
- Ring → two operations (+, ·)
- Integral Domain → no zero divisors
- Field → division possible (except by 0)
Final Conclusion
-
These algebraic structures are foundation of:
- Cryptographic algorithms
- Finite fields (used in AES, ECC)
Week - 3
Lecture 14:
Number Theory
Number Theory (Basics for Cryptography)
Overview
- Study of integers and their properties
- Foundation for cryptographic systems like RSA
Prime Numbers
Definition
- Integer ( > 1 ) with exactly 2 divisors:
Examples
- Prime: 2, 3, 5, 7
- Not prime: 6 (divisors: 1,2,3,6)
✔ Note: 1 is not prime
Composite Numbers
- Integers that are not prime
- Have more than 2 divisors
Fundamental Theorem of Arithmetic
-
Every integer is:
- Either prime, or
- Product of prime factors
Division Algorithm
Where:
- ( q ) = quotient
- ( r ) = remainder
- ( 0 \le r < b )
Example
Divisibility
- ( b \mid a ) means:
- Remainder = 0
Greatest Common Divisor (GCD)
Definition
- Largest number dividing both ( a ) and ( b )
Example
- ( a = 24, b = 32 )
Common divisors:
\gcd(24,32) = 8$$
Key Property
- Used in Euclidean Algorithm
Euclidean Algorithm
Idea
- Repeatedly apply division:
Steps
-
Compute ( )
-
Replace:
- ( )
- ( )
-
Repeat until ( r = 0 )
-
Last non-zero remainder = gcd
Modulo Operation
From:
Key Takeaways
-
Prime numbers → core of cryptography
-
Every number → unique prime factorization
-
GCD → important for:
- Modular inverse
- RSA
-
Euclidean algorithm → efficient gcd computation
Final Conclusion
-
Number theory provides:
- Mathematical backbone for cryptography
- Tools like primes, gcd, modulo arithmetic
-
Essential for modern encryption systems
Week - 3
Lecture 15:
Number Theory (Contd.)
Euclidean Algorithm
Goal
- Compute:
Idea
Algorithm
Input: Integers ( a, b ) ( ( b > 0 ) ) Output: ( )
while b ≠ 0:
r = a mod b
a = b
b = r
return a
Example
Find ( )
✔ Answer:
Recursive Form
Continue until:
Extended Result (Important)
-
( )
-
Used in:
- Modular inverse
- RSA
Modular Arithmetic
Definition
- Means: [ a \bmod n = b \bmod n ]
Example
Properties (Equivalence Relation)
1. Reflexive
2. Symmetric
3. Transitive
Equivalence Classes
- Integers grouped by same remainder
Example: ( )
Operations in ( )
Addition
Properties
-
Closure
-
Identity:
-
Inverse:
-
Commutative:
Generator in ( )
- Element 1 generates entire group:
✔ Cyclic group
Key Takeaways
- Euclidean algorithm → efficient gcd
- Extended form → linear combination
- Modular arithmetic → core of cryptography
- ( ) forms cyclic group under addition
Final Conclusion
-
These concepts are essential for:
- Modular inverse
- RSA
- Diffie-Hellman
-
Form backbone of modern cryptography