This commit is contained in:
John Gatward committed 2026-10-04 15:24:17 +01:00
1 parent d0f27f276b
commit d6f54d4ec2
103 files changed
+3663 -3779

No files matched your search

+26 -27
View File
@@ -10,7 +10,7 @@
**Asymmetric**
>“Methods which use separate, but related, private and public keys.”
> “Methods which use separate, but related, private and public keys.”
**Protocols**
@@ -20,7 +20,7 @@
> “The science and art of breaking cryptosystems.”
### Modern Cyptography (1970-)
### Modern Cryptography (1970-)
**Fundamentally different** - a scientific and mathematical discipline
@@ -46,13 +46,12 @@
- Modular arithmetic is a system of arithmetic for finite sets of integers
- Common sets include
- $\mathbb{N} = \{1,2,3,...\}$
- $\mathbb{Z} = \{..., -3, -2, -1, 0,1,2,3,...\}$
- Also $\mathbb{Q}, \mathbb{R}, \mathbb{C}$
- $\mathbb{N} = \{1,2,3,...\}$
- $\mathbb{Z} = \{..., -3, -2, -1, 0,1,2,3,...\}$
- Also $\mathbb{Q}, \mathbb{R}, \mathbb{C}$
- Cryptography is almost always interested in finite sets
- This is useful as it avoids overflow errors
- When we add or multiply two 1 byte binary digits, the result will always be 1 byte
- When we add or multiply two 1 byte binary digits, the result will always be 1 byte
###### Congruence
@@ -73,7 +72,7 @@ This can be rewritten as: $a = q\cdot m+r$
###### Equivalence Classes
- The sets of all integers **mod 5** form a series of equivalence classes
- All these numbers act the same in any modluo sum
- All these numbers act the same in any modulo sum
For example
@@ -99,25 +98,25 @@ The integer ring $\mathbb{Z}_m$ consists of:
1. The set $\mathbb{Z}_m = \{0, 1,\ldots m-1\}$
2. Two operations $+$ and $\cdot$ for all $a, b \in \mathbb{Z}_m$ such that:
1. $a+b \equiv c \space (mod\space m), (c\in \mathbb{Z})$
2. $a\cdot b \equiv d \space (mod\space m), (d\in \mathbb{Z})$
1. $a+b \equiv c \space (mod\space m), (c\in \mathbb{Z})$
2. $a\cdot b \equiv d \space (mod\space m), (d\in \mathbb{Z})$
Any time you add or multiply any two numbers in the set, the result is always in the set. We use $\equiv$ instead of $=$ as it could be an intermediatary number e.g. 12 instead of 2.
Any time you add or multiply any two numbers in the set, the result is always in the set. We use $\equiv$ instead of $=$ as it could be an intermediate number, e.g. 12 instead of 2.
##### Properties of Rings
- We can add or multiply any two numbers in the ring, and the result is in the ring
- It is closed
- It is closed
- Addition and multiplication are associative
- (a+b)+c = a + (b+c)
- (a+b)+c = a + (b+c)
- There is a neutral element 0 for addition
- $a + 0 \equiv a\space mod \space m$
- $a + 0 \equiv a\space mod \space m$
- The additive inverse always exists
- $a + (-a) = 0\space mod \space m$
- $a + (-a) = 0\space mod \space m$
- There is a neutral element for multiplication
- $a\cdot 1 \equiv a\space mod\space m$
- $a\cdot 1 \equiv a\space mod\space m$
- The multiplicative inverse exists for some but not all elements
- $a\cdot a^{-1} \equiv 1 \space mod \space m$
- $a\cdot a^{-1} \equiv 1 \space mod \space m$
#### Modular Inversion
@@ -158,7 +157,7 @@ $$
##### Frequency Analysis
- The frequency of occurrences of each character are very consistent
- The frequency of occurrences of each character is very consistent
- The longer a cipher text is, the easier this becomes
#### Affine Cipher
@@ -174,23 +173,23 @@ $$
where $k=(a,b)$ and $gcd(a,26)=1$
This is a multiplication and a addition analagous to $y=mx+c$
This is a multiplication and an addition analogous to $y=mx+c$
In a Affine cipher, letters can be themselves
In an Affine cipher, letters can be themselves
- The keyspace of an affine cipher
- a can be 0-25
- b can be 0-12
- 25*12=300
- More secure than a caesar cipher
- a can be 0-25
- b can be 0-12
- 25*12=300
- More secure than a Caesar cipher
Frequency analysis can still be used, in this case the columns will not only be shifted, but jumbled aswell.
Frequency analysis can still be used; in this case the columns will not only be shifted, but jumbled as well.
- This is not hard to crack
#### The Vigenere Cipher
- An early stream cipher, the Vigenere cipher is a shift cipher with a running key
- Unlike caesar cipher, the key is repeated for as long as required.
- Unlike the Caesar cipher, the key is repeated for as long as required.
- It is the equivalent to multiple interleaved Caesar ciphers
- Spreads outs occurrances of characters making frequency analysis hard.
- Spreads out occurrences of characters, making frequency analysis hard.