Add second year

This commit is contained in:
2023-12-07 01:19:12 +00:00
parent 3291e5c79e
commit 3d12031ab8
1168 changed files with 431409 additions and 0 deletions

View File

@ -0,0 +1,315 @@
- #[[CT255 - Next Generation Technologies II]]
- **Previous Topic:** [[GDPR]]
- **Next Topic:** null
- **Relevant Slides:** ![ct255_02.pdf](../assets/ct255_02_1663458790357_0.pdf)
id:: 63265db7-1d41-44f7-b4cf-0bab377a7c1c
-
- ## SQL Injections
- What is an **SQL Injection**? #card
card-last-interval:: 4
card-repeats:: 1
card-ease-factor:: 2.36
card-next-schedule:: 2022-09-22T14:46:36.580Z
card-last-reviewed:: 2022-09-18T14:46:36.581Z
card-last-score:: 3
- An **SQL Injection** is a ^^code injection technique^^ used to attack data-driven applications, in which malicious SQL statements are inserted for execution.
- It is a way of exploiting user input & SQL statements to compromise the database & retrieve sensitive data.
-
- ## Basic Terminology
- What is **Cryptography**? #card
card-last-interval:: 4
card-repeats:: 1
card-ease-factor:: 2.6
card-next-schedule:: 2022-09-22T14:46:04.518Z
card-last-reviewed:: 2022-09-18T14:46:04.518Z
card-last-score:: 5
- **Cryptography** is the art of encompassing the principles & methods of transforming an intelligible message into one that is unintelligible, and then retransforming that message back into its original form.
- What is **Plaintext**? #card
card-last-interval:: 4
card-repeats:: 1
card-ease-factor:: 2.6
card-next-schedule:: 2022-09-22T14:39:41.558Z
card-last-reviewed:: 2022-09-18T14:39:41.558Z
card-last-score:: 5
- **Plaintext** is the ^^original, intelligible message.^^
- What is **Ciphertext**? #card
card-last-interval:: 4
card-repeats:: 1
card-ease-factor:: 2.6
card-next-schedule:: 2022-09-22T14:39:52.620Z
card-last-reviewed:: 2022-09-18T14:39:52.621Z
card-last-score:: 5
- **Ciphertext** is the encrypted messsage.
- What is a **Cipher**? #card
card-last-interval:: 4
card-repeats:: 1
card-ease-factor:: 2.6
card-next-schedule:: 2022-09-22T14:44:53.575Z
card-last-reviewed:: 2022-09-18T14:44:53.575Z
card-last-score:: 5
- A **Cipher** is an algorithm for transforming an intelligible message into one that is unintelligible.
- What is a **Key**? #card
card-last-interval:: 4
card-repeats:: 1
card-ease-factor:: 2.36
card-next-schedule:: 2022-09-22T14:43:53.075Z
card-last-reviewed:: 2022-09-18T14:43:53.075Z
card-last-score:: 3
- A **Key** is some critical information used by the cipher, known only to the sender & receiver, selected from a **keyspace** (the set of all possible keys).
- What does **Encipher** mean? #card
card-last-interval:: 4
card-repeats:: 1
card-ease-factor:: 2.6
card-next-schedule:: 2022-09-22T14:46:57.114Z
card-last-reviewed:: 2022-09-18T14:46:57.114Z
card-last-score:: 5
- **Enciphering** is the process of converting plaintext into ciphertext using a cipher & a key.
- What does **Decipher** mean? #card
card-last-interval:: 4
card-repeats:: 1
card-ease-factor:: 2.6
card-next-schedule:: 2022-09-22T14:43:30.989Z
card-last-reviewed:: 2022-09-18T14:43:30.989Z
card-last-score:: 5
- **Deciphering** is the process of converting ciphertext back into plaintext using a cipher & a key.
- What is **Encryption**? #card
card-last-interval:: 4
card-repeats:: 1
card-ease-factor:: 2.36
card-next-schedule:: 2022-09-22T14:44:36.754Z
card-last-reviewed:: 2022-09-18T14:44:36.755Z
card-last-score:: 3
- **Encryption** is some mathematical function $E_K()$ mapping plaintext $P$ to ciphertext $C$ using the specified key $K$.
- $$C=E_K(P)$$
- What is **Decryption**? #card
card-last-interval:: 4
card-repeats:: 1
card-ease-factor:: 2.36
card-next-schedule:: 2022-09-22T14:45:19.915Z
card-last-reviewed:: 2022-09-18T14:45:19.915Z
card-last-score:: 3
- **Decryption** is some mathematical function ${E_K}^{-1}()$ mapping the ciphertext $C$ to plaintext $P$ using the specified key $K$.
- $$P={E_K}^{-1}(C)$$
- What is **Cryptanalysis**? #card
card-last-interval:: 4
card-repeats:: 1
card-ease-factor:: 2.6
card-next-schedule:: 2022-09-22T14:41:43.525Z
card-last-reviewed:: 2022-09-18T14:41:43.525Z
card-last-score:: 5
- **Cryptanalysis** is the study of principles & methods of transforming an unintelligible message into an intelligible message without knowledge of the key.
- What is **Cryptology**? #card
card-last-interval:: 4
card-repeats:: 1
card-ease-factor:: 2.36
card-next-schedule:: 2022-09-22T14:39:33.475Z
card-last-reviewed:: 2022-09-18T14:39:33.475Z
card-last-score:: 3
- **Cryptology** is the field encompassing both cryptography & cryptanalysis.
-
-
- ## Model of Conventional Cryptosystem
- ![image.png](../assets/image_1663459919021_0.png){:height 304, :width 610}
- ## Cryptanalysis via Letter Frequency Distribution
- Human languages are **redundant** - letters are not equally commonly used.
- In the **English** language:
- **E** is by far the most common letter followed by T, R, N, I, O, A, and S.
- Other letters like Z, J, K, Q, and X are fairly rare.
- Certain letter combinations like **TH** are quite common.
- ![image.png](../assets/image_1663488626792_0.png)
-
- ### C Program for Frequency Analysis of single Characters
- ```c
#include <stdio.h>
#include <string.h>
#include <ctype.h>
int main(int argc, char* argv[]) {
FILE* fp;
int data[26];
char c;
memset(data, 0, siezof(data));
if (argc != 2) {
return(-1);
}
if (fp = fopen(argv[1], "r" == NULL)) {
return(-2);
}
while(!feof(fp)) {
c = toupper(fgetc(fp));
if ((c >= 'A') && (c <= 'Z')) {
data[c-65]++;
}
}
for (int i = 0; i < 26; i++) {
printf("%c:%i\n", i+65, data[i]);
}
fclose(fp);
return(0);
}
```
- ## Known Plaintext Attacks (KPA)
- What is a **Known Plaintext Attack (KPA)**? #card
card-last-interval:: 4
card-repeats:: 1
card-ease-factor:: 2.36
card-next-schedule:: 2022-09-22T14:46:48.201Z
card-last-reviewed:: 2022-09-18T14:46:48.202Z
card-last-score:: 3
- The **Known Plaintext Attack (KPA)** is an attack model for cryptanalysis where the attacker has access to both:
- some of, or all of, the plaintext (called a **crib**)
- the ciphertext
-
-
- ## Caesar Cipher
- What is a **Caesar Cipher**? #card
card-last-interval:: 4
card-repeats:: 1
card-ease-factor:: 2.6
card-next-schedule:: 2022-09-22T14:44:47.075Z
card-last-reviewed:: 2022-09-18T14:44:47.075Z
card-last-score:: 5
- A **Caesar Cipher** involves using an offset alphabet to encrypt a message.
- We can use any shift from 1 to 25 to replace each plaintext letter with a letter a fixed distance away.
- The **key letter** represents the start of this offset alphabet.
- For example, a key letter of F means that A -> F, B -> G, and so on.
- ## Playfair Cipher
- Not even the large number of keys in a monoalphabetic cipher provides security.
- What is a **monoalphabetic cipher**? #card
card-last-interval:: 4
card-repeats:: 1
card-ease-factor:: 2.6
card-next-schedule:: 2022-09-22T14:40:09.236Z
card-last-reviewed:: 2022-09-18T14:40:09.237Z
card-last-score:: 5
- A **monoalphabetic cipher** is any cipher in which the letters of the plaintext are mapped to ciphertext letters based on a single alphabetic key.
- One approach to improving security over monoalphabetic ciphers is to to encrypt ^^multiple letters.^^
- The **Playfair Cipher** is one example of such an approach.
- The algorithm was invented by Charles Wheatstone in 1854, but named after his friend Baron Playfair.
- ### How does the Playfair Cipher work? #card
card-last-interval:: -1
card-repeats:: 1
card-ease-factor:: 2.5
card-next-schedule:: 2022-09-18T23:00:00.000Z
card-last-reviewed:: 2022-09-18T14:43:16.213Z
card-last-score:: 1
- ![image.png](../assets/image_1663491286810_0.png)
- 1. Create a 5x5 grid of letters; insert the keyword as shown, with each letter only considered once; fill the grid with the remaining letters in alphabetic order.
- 2. The letters are then encrypted in pairs.
- 3. Repeats have an "X" inserted.
- BALLOON -> BA LX LO ON
- 4. Letters that fall in the same row are replaced with the letter on the right.
- OK -> GM
- 5. Letters in the same column are replaced with the letter below.
- FO -> OU
- 6. Otherwise, each letter gets replaced by the letter in its row but in the other letters column.
- QM -> TH
- ### Security of the Playfair Cipher
- The security is much improved over simple monoalphabetic ciphers, as the Playfair Cipher has $26^2 = 676$ combinations.
- This requires a 676 entry frequency table to analyse (as compared to a 26 entry frequency table for a monoalphabetic cipher) and correspondingly, more ciphertext.
- However, the Playfair Cipher *can* be cracked through frequency analysis of letter pairs, given a few hundred letters.
-
- ## Vigenère Cipher
- [Blaise de Vigenère](https://en.wikipedia.org/wiki/Blaise_de_Vigen%C3%A8re) is generally credited as the inventor of the **Polyalphabetic Substitution Cipher**.
- What is a **Polyalphabetic Substitution Cipher**? #card
card-last-interval:: 4
card-repeats:: 1
card-ease-factor:: 2.6
card-next-schedule:: 2022-09-22T14:39:24.910Z
card-last-reviewed:: 2022-09-18T14:39:24.912Z
card-last-score:: 5
- A **Polyalphabetic Substitution Cipher** uses multiple substitution alphabets, as opposed to a monoalphabetic cipher which uses a single alphabetic key.
- The Vigenère Cipher improves security by using many monoalphabetic substitution alphabets, so each letter can be replaced by many others.
- You use a **key** to select which alphabet is used for each letter of the message.
- The $i^{th}$ letter of the key specifies the $i^{th}$ alphabet to use.
- Use each alphabet in turn.
- Repeat from the start after the end of the key is reached.
-
- ### Vigenère Steps
- ![image.png](../assets/image_1663494147352_0.png)
- 1. Write the plaintext out, and write the keyword underneath it, repeated, for the length of the plaintext.
- 2. Use each key letter in turn as a Caesar cipher key.
- 3. Encrypt the corresponding plaintext letter.
- In this example, we use the keyword "CIPHER". Hence, we have the following translation alphabets:
- ![image.png](../assets/image_1663494236099_0.png)
- ### How to crack the Vigenère Cipher
- 1. Search the ciphertext for repeated strings of letters - the longer the string, the better.
- 2. For each occurrence of a repeated string, count how many letters are between the first letters in the string, and add one.
- 3. Factorise that number.
- 4. Repeat this process with each repeated string you find and make a table of common factors. The most common factor, $n$ is most likely the length of the keyword used to encipher the ciphertext.
- 5. Do a frequency count on the ciphertext, on every $n^{th}$ letter. You should end up with $n$ different frequency counts.
- 6. Compare these counts to standard frequency tables to figure out how much each letter was shifted by.
- 7. Undo the shifts and read the message.
- ## Enigma (Rotor Ciphers)
- ### Rotor Ciphers
- The mechanisation / automation of encryption.
- An $\text{N}$-stage polyalphabetic algorithm modulo 26.
- $26^N$ steps before a repetition, where $N$ is the number of cylinders.
- The Enigma machine had 5 cylinders, so:
- $$26^{N=5}=11,881,376 \text{ steps}$$
-
- ### Breaking Enigma using **Cribs**
- The starting point for breaking Enigma was based on the following:
- Plaintext messages were likely to contain certain phrases.
- Weather reports contained the term "WETTER VORHERSAGE".
- Military units often sent messages containing "KEINE BESONDEREN EREIGNISSE" ("nothing to report").
- A plaintext letter was never mapped onto the same ciphertext letter.
- While the cryptanalysts in Bletchely Park did not know exactly where these cribs were placed in an intercepted message, they could exclude certain positions.
- ![image.png](../assets/image_1663500888551_0.png)
- From here, possible rotor start positions & rotor wiring would be systematically examined using the "bombe" - an electromechanical device designed by Turing that replicated the action of several Enigma machines wired together.
-
- ## Transposition Ciphers
- What are **Transposition Ciphers**? #card
card-last-interval:: -1
card-repeats:: 1
card-ease-factor:: 2.5
card-next-schedule:: 2022-09-18T23:00:00.000Z
card-last-reviewed:: 2022-09-18T14:46:25.289Z
card-last-score:: 1
- **Transposition** or **Permutation Ciphers** hide the message by rearranging the letter order ^^without altering the actual letters used.^^
- This can be recognised since the ciphertext has the same frequency distribution as the original text.
- ### Rail Fence Cipher
- Write plaintext letters out diagonally over a number of rows, then read off the cipher row by row.
- ![image.png](../assets/image_1663501467907_0.png)
- ### Row Transposition Cipher
- What are **Row Transposition Ciphers**? #card
card-last-interval:: -1
card-repeats:: 1
card-ease-factor:: 2.5
card-next-schedule:: 2022-09-18T23:00:00.000Z
card-last-reviewed:: 2022-09-18T14:41:09.367Z
card-last-score:: 1
- **Row Transposition Ciphers** are a more complex kind of transposition cipher than Rail Fence Ciphers.
- Plaintext letters are written out in rows over a specified number of columns.
- The columns are then re-ordered according to some key before reading off the columns
- ![image.png](../assets/image_1663501773385_0.png)
-
- ## Product Ciphers
- Ciphers using just substitutions or transpositions are not secure because of language characteristics.
- Consider using several ciphers in succession to make it harder to crack:
- Two substitutions make a more complex substitution.
- Two transpositions make a more complex transposition.
- However, a substitution followed by a transposition makes a much harder cipher.
-
-
- # Steganography
- What is **Steganography**? #card
card-last-interval:: 4
card-repeats:: 1
card-ease-factor:: 2.6
card-next-schedule:: 2022-09-22T14:45:30.141Z
card-last-reviewed:: 2022-09-18T14:45:30.142Z
card-last-score:: 5
- **Steganography** is an alternative to encryption that hides the existence of the message.
- For example:
- Using only a subset of letters / words in a message marked in some way.
- Using invisible ink.
- Hiding in LSB in graphic image or sound file.
- The drawback of steganography is that it's not very economical in terms of overheads to hide a message.
-

View File

@ -0,0 +1,315 @@
- #[[CT255 - Next Generation Technologies II]]
- **Previous Topic:** [[GDPR]]
- **Next Topic:** null
- **Relevant Slides:** ![ct255_02.pdf](../assets/ct255_02_1663458790357_0.pdf)
id:: 63265db7-1d41-44f7-b4cf-0bab377a7c1c
-
- ## SQL Injections
- What is an **SQL Injection**? #card
card-last-interval:: 4
card-repeats:: 1
card-ease-factor:: 2.36
card-next-schedule:: 2022-09-22T14:46:36.580Z
card-last-reviewed:: 2022-09-18T14:46:36.581Z
card-last-score:: 3
- An **SQL Injection** is a ^^code injection technique^^ used to attack data-driven applications, in which malicious SQL statements are inserted for execution.
- It is a way of exploiting user input & SQL statements to compromise the database & retrieve sensitive data.
-
- ## Basic Terminology
- What is **Cryptography**? #card
card-last-interval:: 4
card-repeats:: 1
card-ease-factor:: 2.6
card-next-schedule:: 2022-09-22T14:46:04.518Z
card-last-reviewed:: 2022-09-18T14:46:04.518Z
card-last-score:: 5
- **Cryptography** is the art of encompassing the principles & methods of transforming an intelligible message into one that is unintelligible, and then retransforming that message back into its original form.
- What is **Plaintext**? #card
card-last-interval:: 4
card-repeats:: 1
card-ease-factor:: 2.6
card-next-schedule:: 2022-09-22T14:39:41.558Z
card-last-reviewed:: 2022-09-18T14:39:41.558Z
card-last-score:: 5
- **Plaintext** is the ^^original, intelligible message.^^
- What is **Ciphertext**? #card
card-last-interval:: 4
card-repeats:: 1
card-ease-factor:: 2.6
card-next-schedule:: 2022-09-22T14:39:52.620Z
card-last-reviewed:: 2022-09-18T14:39:52.621Z
card-last-score:: 5
- **Ciphertext** is the encrypted messsage.
- What is a **Cipher**? #card
card-last-interval:: 4
card-repeats:: 1
card-ease-factor:: 2.6
card-next-schedule:: 2022-09-22T14:44:53.575Z
card-last-reviewed:: 2022-09-18T14:44:53.575Z
card-last-score:: 5
- A **Cipher** is an algorithm for transforming an intelligible message into one that is unintelligible.
- What is a **Key**? #card
card-last-interval:: 4
card-repeats:: 1
card-ease-factor:: 2.36
card-next-schedule:: 2022-09-22T14:43:53.075Z
card-last-reviewed:: 2022-09-18T14:43:53.075Z
card-last-score:: 3
- A **Key** is some critical information used by the cipher, known only to the sender & receiver, selected from a **keyspace** (the set of all possible keys).
- What does **Encipher** mean? #card
card-last-interval:: 4
card-repeats:: 1
card-ease-factor:: 2.6
card-next-schedule:: 2022-09-22T14:46:57.114Z
card-last-reviewed:: 2022-09-18T14:46:57.114Z
card-last-score:: 5
- **Enciphering** is the process of converting plaintext into ciphertext using a cipher & a key.
- What does **Decipher** mean? #card
card-last-interval:: 4
card-repeats:: 1
card-ease-factor:: 2.6
card-next-schedule:: 2022-09-22T14:43:30.989Z
card-last-reviewed:: 2022-09-18T14:43:30.989Z
card-last-score:: 5
- **Deciphering** is the process of converting ciphertext back into plaintext using a cipher & a key.
- What is **Encryption**? #card
card-last-interval:: 4
card-repeats:: 1
card-ease-factor:: 2.36
card-next-schedule:: 2022-09-22T14:44:36.754Z
card-last-reviewed:: 2022-09-18T14:44:36.755Z
card-last-score:: 3
- **Encryption** is some mathematical function $E_K()$ mapping plaintext $P$ to ciphertext $C$ using the specified key $K$.
- $$C=E_K(P)$$
- What is **Decryption**? #card
card-last-interval:: 4
card-repeats:: 1
card-ease-factor:: 2.36
card-next-schedule:: 2022-09-22T14:45:19.915Z
card-last-reviewed:: 2022-09-18T14:45:19.915Z
card-last-score:: 3
- **Decryption** is some mathematical function ${E_K}^{-1}()$ mapping the ciphertext $C$ to plaintext $P$ using the specified key $K$.
- $$P={E_K}^{-1}(C)$$
- What is **Cryptanalysis**? #card
card-last-interval:: 4
card-repeats:: 1
card-ease-factor:: 2.6
card-next-schedule:: 2022-09-22T14:41:43.525Z
card-last-reviewed:: 2022-09-18T14:41:43.525Z
card-last-score:: 5
- **Cryptanalysis** is the study of principles & methods of transforming an unintelligible message into an intelligible message without knowledge of the key.
- What is **Cryptology**? #card
card-last-interval:: 4
card-repeats:: 1
card-ease-factor:: 2.36
card-next-schedule:: 2022-09-22T14:39:33.475Z
card-last-reviewed:: 2022-09-18T14:39:33.475Z
card-last-score:: 3
- **Cryptology** is the field encompassing both cryptography & cryptanalysis.
-
-
- ## Model of Conventional Cryptosystem
- ![image.png](../assets/image_1663459919021_0.png){:height 304, :width 610}
- ## Cryptanalysis via Letter Frequency Distribution
- Human languages are **redundant** - letters are not equally commonly used.
- In the **English** language:
- **E** is by far the most common letter followed by T, R, N, I, O, A, and S.
- Other letters like Z, J, K, Q, and X are fairly rare.
- Certain letter combinations like **TH** are quite common.
- ![image.png](../assets/image_1663488626792_0.png)
-
- ### C Program for Frequency Analysis of single Characters
- ```c
#include <stdio.h>
#include <string.h>
#include <ctype.h>
int main(int argc, char* argv[]) {
FILE* fp;
int data[26];
char c;
memset(data, 0, siezof(data));
if (argc != 2) {
return(-1);
}
if (fp = fopen(argv[1], "r" == NULL)) {
return(-2);
}
while(!feof(fp)) {
c = toupper(fgetc(fp));
if ((c >= 'A') && (c <= 'Z')) {
data[c-65]++;
}
}
for (int i = 0; i < 26; i++) {
printf("%c:%i\n", i+65, data[i]);
}
fclose(fp);
return(0);
}
```
- ## Known Plaintext Attacks (KPA)
- What is a **Known Plaintext Attack (KPA)**? #card
card-last-interval:: 4
card-repeats:: 1
card-ease-factor:: 2.36
card-next-schedule:: 2022-09-22T14:46:48.201Z
card-last-reviewed:: 2022-09-18T14:46:48.202Z
card-last-score:: 3
- The **Known Plaintext Attack (KPA)** is an attack model for cryptanalysis where the attacker has access to both:
- some of, or all of, the plaintext (called a **crib**)
- the ciphertext
-
-
- ## Caesar Cipher
- What is a **Caesar Cipher**? #card
card-last-interval:: 4
card-repeats:: 1
card-ease-factor:: 2.6
card-next-schedule:: 2022-09-22T14:44:47.075Z
card-last-reviewed:: 2022-09-18T14:44:47.075Z
card-last-score:: 5
- A **Caesar Cipher** involves using an offset alphabet to encrypt a message.
- We can use any shift from 1 to 25 to replace each plaintext letter with a letter a fixed distance away.
- The **key letter** represents the start of this offset alphabet.
- For example, a key letter of F means that A -> F, B -> G, and so on.
- ## Playfair Cipher
- Not even the large number of keys in a monoalphabetic cipher provides security.
- What is a **monoalphabetic cipher**? #card
card-last-interval:: 4
card-repeats:: 1
card-ease-factor:: 2.6
card-next-schedule:: 2022-09-22T14:40:09.236Z
card-last-reviewed:: 2022-09-18T14:40:09.237Z
card-last-score:: 5
- A **monoalphabetic cipher** is any cipher in which the letters of the plaintext are mapped to ciphertext letters based on a single alphabetic key.
- One approach to improving security over monoalphabetic ciphers is to to encrypt ^^multiple letters.^^
- The **Playfair Cipher** is one example of such an approach.
- The algorithm was invented by Charles Wheatstone in 1854, but named after his friend Baron Playfair.
- ### How does the Playfair Cipher work? #card
card-last-interval:: -1
card-repeats:: 1
card-ease-factor:: 2.5
card-next-schedule:: 2022-09-18T23:00:00.000Z
card-last-reviewed:: 2022-09-18T14:43:16.213Z
card-last-score:: 1
- ![image.png](../assets/image_1663491286810_0.png)
- 1. Create a 5x5 grid of letters; insert the keyword as shown, with each letter only considered once; fill the grid with the remaining letters in alphabetic order.
- 2. The letters are then encrypted in pairs.
- 3. Repeats have an "X" inserted.
- BALLOON -> BA LX LO ON
- 4. Letters that fall in the same row are replaced with the letter on the right.
- OK -> GM
- 5. Letters in the same column are replaced with the letter below.
- FO -> OU
- 6. Otherwise, each letter gets replaced by the letter in its row but in the other letters column.
- QM -> TH
- ### Security of the Playfair Cipher
- The security is much improved over simple monoalphabetic ciphers, as the Playfair Cipher has $26^2 = 676$ combinations.
- This requires a 676 entry frequency table to analyse (as compared to a 26 entry frequency table for a monoalphabetic cipher) and correspondingly, more ciphertext.
- However, the Playfair Cipher *can* be cracked through frequency analysis of letter pairs, given a few hundred letters.
-
- ## Vigenère Cipher
- [Blaise de Vigenère](https://en.wikipedia.org/wiki/Blaise_de_Vigen%C3%A8re) is generally credited as the inventor of the **Polyalphabetic Substitution Cipher**.
- What is a **Polyalphabetic Substitution Cipher**? #card
card-last-interval:: 4
card-repeats:: 1
card-ease-factor:: 2.6
card-next-schedule:: 2022-09-22T14:39:24.910Z
card-last-reviewed:: 2022-09-18T14:39:24.912Z
card-last-score:: 5
- A **Polyalphabetic Substitution Cipher** uses multiple substitution alphabets, as opposed to a monoalphabetic cipher which uses a single alphabetic key.
- The Vigenère Cipher improves security by using many monoalphabetic substitution alphabets, so each letter can be replaced by many others.
- You use a **key** to select which alphabet is used for each letter of the message.
- The $i^{th}$ letter of the key specifies the $i^{th}$ alphabet to use.
- Use each alphabet in turn.
- Repeat from the start after the end of the key is reached.
-
- ### Vigenère Steps
- ![image.png](../assets/image_1663494147352_0.png)
- 1. Write the plaintext out, and write the keyword underneath it, repeated, for the length of the plaintext.
- 2. Use each key letter in turn as a Caesar cipher key.
- 3. Encrypt the corresponding plaintext letter.
- In this example, we use the keyword "CIPHER". Hence, we have the following translation alphabets:
- ![image.png](../assets/image_1663494236099_0.png)
- ### How to crack the Vigenère Cipher
- 1. Search the ciphertext for repeated strings of letters - the longer the string, the better.
- 2. For each occurrence of a repeated string, count how many letters are between the first letters in the string, and add one.
- 3. Factorise that number.
- 4. Repeat this process with each repeated string you find and make a table of common factors. The most common factor, $n$ is most likely the length of the keyword used to encipher the ciphertext.
- 5. Do a frequency count on the ciphertext, on every $n^{th}$ letter. You should end up with $n$ different frequency counts.
- 6. Compare these counts to standard frequency tables to figure out how much each letter was shifted by.
- 7. Undo the shifts and read the message.
- ## Enigma (Rotor Ciphers)
- ### Rotor Ciphers
- The mechanisation / automation of encryption.
- An $\text{N}$-stage polyalphabetic algorithm modulo 26.
- $26^N$ steps before a repetition, where $N$ is the number of cylinders.
- The Enigma machine had 5 cylinders, so:
- $$26^{N=5}=11,881,376 \text{ steps}$$
-
- ### Breaking Enigma using **Cribs**
- The starting point for breaking Enigma was based on the following:
- Plaintext messages were likely to contain certain phrases.
- Weather reports contained the term "WETTER VORHERSAGE".
- Military units often sent messages containing "KEINE BESONDEREN EREIGNISSE" ("nothing to report").
- A plaintext letter was never mapped onto the same ciphertext letter.
- While the cryptanalysts in Bletchely Park did not know exactly where these cribs were placed in an intercepted message, they could exclude certain positions.
- ![image.png](../assets/image_1663500888551_0.png)
- From here, possible rotor start positions & rotor wiring would be systematically examined using the "bombe" - an electromechanical device designed by Turing that replicated the action of several Enigma machines wired together.
-
- ## Transposition Ciphers
- What are **Transposition Ciphers**? #card
card-last-interval:: -1
card-repeats:: 1
card-ease-factor:: 2.5
card-next-schedule:: 2022-09-18T23:00:00.000Z
card-last-reviewed:: 2022-09-18T14:46:25.289Z
card-last-score:: 1
- **Transposition** or **Permutation Ciphers** hide the message by rearranging the letter order ^^without altering the actual letters used.^^
- This can be recognised since the ciphertext has the same frequency distribution as the original text.
- ### Rail Fence Cipher
- Write plaintext letters out diagonally over a number of rows, then read off the cipher row by row.
- ![image.png](../assets/image_1663501467907_0.png)
- ### Row Transposition Cipher
- What are **Row Transposition Ciphers**? #card
card-last-interval:: -1
card-repeats:: 1
card-ease-factor:: 2.5
card-next-schedule:: 2022-09-18T23:00:00.000Z
card-last-reviewed:: 2022-09-18T14:41:09.367Z
card-last-score:: 1
- **Row Transposition Ciphers** are a more complex kind of transposition cipher than Rail Fence Ciphers.
- Plaintext letters are written out in rows over a specified number of columns.
- The columns are then re-ordered according to some key before reading off the columns
- ![image.png](../assets/image_1663501773385_0.png)
-
- ## Product Ciphers
- Ciphers using just substitutions or transpositions are not secure because of language characteristics.
- Consider using several ciphers in succession to make it harder to crack:
- Two substitutions make a more complex substitution.
- Two transpositions make a more complex transposition.
- However, a substitution followed by a transposition makes a much harder cipher.
-
-
- # Steganography
- What is **Steganography**? #card
card-last-interval:: 4
card-repeats:: 1
card-ease-factor:: 2.6
card-next-schedule:: 2022-09-22T14:45:30.141Z
card-last-reviewed:: 2022-09-18T14:45:30.142Z
card-last-score:: 5
- **Steganography** is an alternative to encryption that hides the existence of the message.
- For example:
- Using only a subset of letters / words in a message marked in some way.
- Using invisible ink.
- Hiding in LSB in graphic image or sound file.
- The drawback of steganography is that it's not very economical in terms of overheads to hide a message.
-

View File

@ -0,0 +1,316 @@
- #[[CT255 - Next Generation Technologies II]]
- **Previous Topic:** [[GDPR]]
- **Next Topic:** [[Human Security & Passwords]]
- **Relevant Slides:** ![ct255_02.pdf](../assets/ct255_02_1663458790357_0.pdf)
id:: 63265db7-1d41-44f7-b4cf-0bab377a7c1c
-
- ## SQL Injections
- What is an **SQL Injection**? #card
card-last-interval:: 4
card-repeats:: 2
card-ease-factor:: 2.46
card-next-schedule:: 2022-10-08T12:29:41.822Z
card-last-reviewed:: 2022-10-04T12:29:41.822Z
card-last-score:: 5
-
- An **SQL Injection** is a ^^code injection technique^^ used to attack data-driven applications, in which malicious SQL statements are inserted for execution.
- It is a way of exploiting user input & SQL statements to compromise the database & retrieve sensitive data.
-
- ## Basic Terminology
- What is **Cryptography**? #card
card-last-interval:: 4
card-repeats:: 2
card-ease-factor:: 2.7
card-next-schedule:: 2022-10-04T12:13:18.768Z
card-last-reviewed:: 2022-09-30T12:13:18.768Z
card-last-score:: 5
- **Cryptography** is the art of encompassing the principles & methods of transforming an intelligible message into one that is unintelligible, and then retransforming that message back into its original form.
- What is **Plaintext**? #card
card-last-interval:: 4
card-repeats:: 2
card-ease-factor:: 2.7
card-next-schedule:: 2022-10-04T12:07:59.453Z
card-last-reviewed:: 2022-09-30T12:07:59.456Z
card-last-score:: 5
- **Plaintext** is the ^^original, intelligible message.^^
- What is **Ciphertext**? #card
card-last-interval:: 4
card-repeats:: 2
card-ease-factor:: 2.7
card-next-schedule:: 2022-10-04T08:29:48.663Z
card-last-reviewed:: 2022-09-30T08:29:48.663Z
card-last-score:: 5
- **Ciphertext** is the encrypted messsage.
- What is a **Cipher**? #card
card-last-interval:: 4
card-repeats:: 2
card-ease-factor:: 2.46
card-next-schedule:: 2022-10-04T12:11:06.873Z
card-last-reviewed:: 2022-09-30T12:11:06.874Z
card-last-score:: 3
- A **Cipher** is an algorithm for transforming an intelligible message into one that is unintelligible.
- What is a **Key**? #card
card-last-interval:: 4
card-repeats:: 2
card-ease-factor:: 2.46
card-next-schedule:: 2022-10-04T12:09:48.972Z
card-last-reviewed:: 2022-09-30T12:09:48.972Z
card-last-score:: 5
- A **Key** is some critical information used by the cipher, known only to the sender & receiver, selected from a **keyspace** (the set of all possible keys).
- What does **Encipher** mean? #card
card-last-interval:: 4
card-repeats:: 2
card-ease-factor:: 2.7
card-next-schedule:: 2022-10-04T12:13:23.717Z
card-last-reviewed:: 2022-09-30T12:13:23.717Z
card-last-score:: 5
- **Enciphering** is the process of converting plaintext into ciphertext using a cipher & a key.
- What does **Decipher** mean?
card-last-interval:: 4
card-repeats:: 2
card-ease-factor:: 2.7
card-next-schedule:: 2022-10-04T12:09:14.829Z
card-last-reviewed:: 2022-09-30T12:09:14.829Z
card-last-score:: 5
- **Deciphering** is the process of converting ciphertext back into plaintext using a cipher & a key.
- What is **Encryption**? #card
card-last-score:: 5
card-repeats:: 2
card-next-schedule:: 2022-10-04T12:09:55.038Z
card-last-interval:: 4
card-ease-factor:: 2.46
card-last-reviewed:: 2022-09-30T12:09:55.039Z
- **Encryption** is some mathematical function $E_K()$ mapping plaintext $P$ to ciphertext $C$ using the specified key $K$.
- $$C=E_K(P)$$
- What is **Decryption**? #card
card-last-interval:: 4
card-repeats:: 2
card-ease-factor:: 2.22
card-next-schedule:: 2022-10-04T12:13:15.777Z
card-last-reviewed:: 2022-09-30T12:13:15.777Z
card-last-score:: 3
- **Decryption** is some mathematical function ${E_K}^{-1}()$ mapping the ciphertext $C$ to plaintext $P$ using the specified key $K$.
- $$P={E_K}^{-1}(C)$$
- What is **Cryptanalysis**? #card
card-last-interval:: 4
card-repeats:: 2
card-ease-factor:: 2.7
card-next-schedule:: 2022-10-04T12:08:29.141Z
card-last-reviewed:: 2022-09-30T12:08:29.141Z
card-last-score:: 5
- **Cryptanalysis** is the study of principles & methods of transforming an unintelligible message into an intelligible message without knowledge of the key.
- What is **Cryptology**? #card
card-last-interval:: 4
card-repeats:: 2
card-ease-factor:: 2.22
card-next-schedule:: 2022-10-04T09:29:41.789Z
card-last-reviewed:: 2022-09-30T09:29:41.789Z
card-last-score:: 3
- **Cryptology** is the field encompassing both cryptography & cryptanalysis.
-
-
- ## Model of Conventional Cryptosystem
- ![image.png](../assets/image_1663459919021_0.png){:height 304, :width 610}
- ## Cryptanalysis via Letter Frequency Distribution
- Human languages are **redundant** - letters are not equally commonly used.
- In the **English** language:
- **E** is by far the most common letter followed by T, R, N, I, O, A, and S.
- Other letters like Z, J, K, Q, and X are fairly rare.
- Certain letter combinations like **TH** are quite common.
- ![image.png](../assets/image_1663488626792_0.png)
-
- ### C Program for Frequency Analysis of single Characters
- ```c
#include <stdio.h>
#include <string.h>
#include <ctype.h>
int main(int argc, char* argv[]) {
FILE* fp;
int data[26];
char c;
memset(data, 0, siezof(data));
if (argc != 2) {
return(-1);
}
if (fp = fopen(argv[1], "r" == NULL)) {
return(-2);
}
while(!feof(fp)) {
c = toupper(fgetc(fp));
if ((c >= 'A') && (c <= 'Z')) {
data[c-65]++;
}
}
for (int i = 0; i < 26; i++) {
printf("%c:%i\n", i+65, data[i]);
}
fclose(fp);
return(0);
}
```
- ## Known Plaintext Attacks (KPA)
- What is a **Known Plaintext Attack (KPA)**? #card
card-last-interval:: 10.24
card-repeats:: 3
card-ease-factor:: 2.56
card-next-schedule:: 2022-10-16T14:39:41.014Z
card-last-reviewed:: 2022-10-06T09:39:41.014Z
card-last-score:: 5
- The **Known Plaintext Attack (KPA)** is an attack model for cryptanalysis where the attacker has access to both:
- some of, or all of, the plaintext (called a **crib**)
- the ciphertext
-
-
- ## Caesar Cipher
- What is a **Caesar Cipher**? #card
card-last-interval:: 4
card-repeats:: 2
card-ease-factor:: 2.7
card-next-schedule:: 2022-10-04T12:09:58.027Z
card-last-reviewed:: 2022-09-30T12:09:58.027Z
card-last-score:: 5
- A **Caesar Cipher** involves using an offset alphabet to encrypt a message.
- We can use any shift from 1 to 25 to replace each plaintext letter with a letter a fixed distance away.
- The **key letter** represents the start of this offset alphabet.
- For example, a key letter of F means that A -> F, B -> G, and so on.
- ## Playfair Cipher
- Not even the large number of keys in a monoalphabetic cipher provides security.
- What is a **monoalphabetic cipher**? #card
card-last-interval:: 4
card-repeats:: 2
card-ease-factor:: 2.7
card-next-schedule:: 2022-10-04T12:08:03.733Z
card-last-reviewed:: 2022-09-30T12:08:03.733Z
card-last-score:: 5
- A **monoalphabetic cipher** is any cipher in which the letters of the plaintext are mapped to ciphertext letters based on a single alphabetic key.
- One approach to improving security over monoalphabetic ciphers is to to encrypt ^^multiple letters.^^
- The **Playfair Cipher** is one example of such an approach.
- The algorithm was invented by Charles Wheatstone in 1854, but named after his friend Baron Playfair.
- ### How does the Playfair Cipher work?
card-last-score:: 5
card-repeats:: 2
card-next-schedule:: 2022-10-08T00:33:19.557Z
card-last-interval:: 3.51
card-ease-factor:: 2.6
card-last-reviewed:: 2022-10-04T12:33:19.558Z
- ![image.png](../assets/image_1663491286810_0.png)
- 1. Create a 5x5 grid of letters; insert the keyword as shown, with each letter only considered once; fill the grid with the remaining letters in alphabetic order.
- 2. The letters are then encrypted in pairs.
- 3. Repeats have an "X" inserted.
- BALLOON -> BA LX LO ON
- 4. Letters that fall in the same row are replaced with the letter on the right.
- OK -> GM
- 5. Letters in the same column are replaced with the letter below.
- FO -> OU
- 6. Otherwise, each letter gets replaced by the letter in its row but in the other letters column.
- QM -> TH
- ### Security of the Playfair Cipher
- The security is much improved over simple monoalphabetic ciphers, as the Playfair Cipher has $26^2 = 676$ combinations.
- This requires a 676 entry frequency table to analyse (as compared to a 26 entry frequency table for a monoalphabetic cipher) and correspondingly, more ciphertext.
- However, the Playfair Cipher *can* be cracked through frequency analysis of letter pairs, given a few hundred letters.
-
- ## Vigenère Cipher
- [Blaise de Vigenère](https://en.wikipedia.org/wiki/Blaise_de_Vigen%C3%A8re) is generally credited as the inventor of the **Polyalphabetic Substitution Cipher**.
- What is a **Polyalphabetic Substitution Cipher**? #card
card-last-interval:: -1
card-repeats:: 1
card-ease-factor:: 2.6
card-next-schedule:: 2022-09-30T23:00:00.000Z
card-last-reviewed:: 2022-09-30T09:29:32.337Z
card-last-score:: 1
- A **Polyalphabetic Substitution Cipher** uses multiple substitution alphabets, as opposed to a monoalphabetic cipher which uses a single alphabetic key.
- The Vigenère Cipher improves security by using many monoalphabetic substitution alphabets, so each letter can be replaced by many others.
- You use a **key** to select which alphabet is used for each letter of the message.
- The $i^{th}$ letter of the key specifies the $i^{th}$ alphabet to use.
- Use each alphabet in turn.
- Repeat from the start after the end of the key is reached.
-
- ### Vigenère Steps
- ![image.png](../assets/image_1663494147352_0.png)
- 1. Write the plaintext out, and write the keyword underneath it, repeated, for the length of the plaintext.
- 2. Use each key letter in turn as a Caesar cipher key.
- 3. Encrypt the corresponding plaintext letter.
- In this example, we use the keyword "CIPHER". Hence, we have the following translation alphabets:
- ![image.png](../assets/image_1663494236099_0.png)
- ### How to crack the Vigenère Cipher
- 1. Search the ciphertext for repeated strings of letters - the longer the string, the better.
- 2. For each occurrence of a repeated string, count how many letters are between the first letters in the string, and add one.
- 3. Factorise that number.
- 4. Repeat this process with each repeated string you find and make a table of common factors. The most common factor, $n$ is most likely the length of the keyword used to encipher the ciphertext.
- 5. Do a frequency count on the ciphertext, on every $n^{th}$ letter. You should end up with $n$ different frequency counts.
- 6. Compare these counts to standard frequency tables to figure out how much each letter was shifted by.
- 7. Undo the shifts and read the message.
- ## Enigma (Rotor Ciphers)
- ### Rotor Ciphers
- The mechanisation / automation of encryption.
- An $\text{N}$-stage polyalphabetic algorithm modulo 26.
- $26^N$ steps before a repetition, where $N$ is the number of cylinders.
- The Enigma machine had 5 cylinders, so:
- $$26^{N=5}=11,881,376 \text{ steps}$$
-
- ### Breaking Enigma using **Cribs**
- The starting point for breaking Enigma was based on the following:
- Plaintext messages were likely to contain certain phrases.
- Weather reports contained the term "WETTER VORHERSAGE".
- Military units often sent messages containing "KEINE BESONDEREN EREIGNISSE" ("nothing to report").
- A plaintext letter was never mapped onto the same ciphertext letter.
- While the cryptanalysts in Bletchely Park did not know exactly where these cribs were placed in an intercepted message, they could exclude certain positions.
- ![image.png](../assets/image_1663500888551_0.png)
- From here, possible rotor start positions & rotor wiring would be systematically examined using the "bombe" - an electromechanical device designed by Turing that replicated the action of several Enigma machines wired together.
-
- ## Transposition Ciphers
- What are **Transposition Ciphers**? #card
card-last-interval:: 4
card-repeats:: 2
card-ease-factor:: 2.36
card-next-schedule:: 2022-10-04T09:08:18.147Z
card-last-reviewed:: 2022-09-30T09:08:18.150Z
card-last-score:: 3
- **Transposition** or **Permutation Ciphers** hide the message by rearranging the letter order ^^without altering the actual letters used.^^
- This can be recognised since the ciphertext has the same frequency distribution as the original text.
- ### Rail Fence Cipher
- Write plaintext letters out diagonally over a number of rows, then read off the cipher row by row.
- ![image.png](../assets/image_1663501467907_0.png)
- ### Row Transposition Cipher
- What are **Row Transposition Ciphers**? #card
card-last-interval:: 3.45
card-repeats:: 2
card-ease-factor:: 2.36
card-next-schedule:: 2022-10-03T19:11:23.311Z
card-last-reviewed:: 2022-09-30T09:11:23.312Z
card-last-score:: 3
- **Row Transposition Ciphers** are a more complex kind of transposition cipher than Rail Fence Ciphers.
- Plaintext letters are written out in rows over a specified number of columns.
- The columns are then re-ordered according to some key before reading off the columns
- ![image.png](../assets/image_1663501773385_0.png)
-
- ## Product Ciphers
- Ciphers using just substitutions or transpositions are not secure because of language characteristics.
- Consider using several ciphers in succession to make it harder to crack:
- Two substitutions make a more complex substitution.
- Two transpositions make a more complex transposition.
- However, a substitution followed by a transposition makes a much harder cipher.
-
-
- # Steganography
- What is **Steganography**? #card
card-last-interval:: 4
card-repeats:: 2
card-ease-factor:: 2.7
card-next-schedule:: 2022-10-08T12:33:34.285Z
card-last-reviewed:: 2022-10-04T12:33:34.285Z
card-last-score:: 5
- **Steganography** is an alternative to encryption that hides the existence of the message.
- For example:
- Using only a subset of letters / words in a message marked in some way.
- Using invisible ink.
- Hiding in LSB in graphic image or sound file.
- The drawback of steganography is that it's not very economical in terms of overheads to hide a message.
-

View File

@ -0,0 +1,316 @@
- #[[CT255 - Next Generation Technologies II]]
- **Previous Topic:** [[GDPR]]
- **Next Topic:** [[Human Security & Passwords]]
- **Relevant Slides:** ![ct255_02.pdf](../assets/ct255_02_1663458790357_0.pdf)
id:: 63265db7-1d41-44f7-b4cf-0bab377a7c1c
-
- ## SQL Injections
- What is an **SQL Injection**? #card
card-last-interval:: 10.6
card-repeats:: 3
card-ease-factor:: 2.56
card-next-schedule:: 2022-10-19T12:58:54.850Z
card-last-reviewed:: 2022-10-08T22:58:54.851Z
card-last-score:: 5
-
- An **SQL Injection** is a ***code injection technique*** used to attack data-driven applications, in which malicious SQL statements are inserted for execution.
- It is a way of exploiting user input & SQL statements to compromise the database & retrieve sensitive data.
-
- ## Basic Terminology
- What is **Cryptography**? #card
card-last-interval:: 33.64
card-repeats:: 4
card-ease-factor:: 2.9
card-next-schedule:: 2022-11-10T01:19:02.918Z
card-last-reviewed:: 2022-10-07T10:19:02.918Z
card-last-score:: 5
- **Cryptography** is the art of encompassing the principles & methods of transforming an intelligible message into one that is unintelligible, and then retransforming that message back into its original form.
- What is **Plaintext**?
card-last-score:: 5
card-repeats:: 3
card-next-schedule:: 2022-10-17T21:24:55.999Z
card-last-interval:: 11.2
card-ease-factor:: 2.8
card-last-reviewed:: 2022-10-06T17:24:55.999Z
- **Plaintext** is the ^^original, intelligible message.^^
- What is **Ciphertext**?
card-last-interval:: 11.2
card-repeats:: 3
card-ease-factor:: 2.8
card-next-schedule:: 2022-10-18T14:39:00.206Z
card-last-reviewed:: 2022-10-07T10:39:00.207Z
card-last-score:: 5
- **Ciphertext** is the encrypted messsage.
- What is a **Cipher**? #card
card-last-interval:: 4.14
card-repeats:: 2
card-ease-factor:: 2.56
card-next-schedule:: 2022-10-13T01:43:58.055Z
card-last-reviewed:: 2022-10-08T22:43:58.056Z
card-last-score:: 5
- A **Cipher** is an algorithm for transforming an intelligible message into one that is unintelligible.
- What is a **Key**? #card
card-last-interval:: 4
card-repeats:: 2
card-ease-factor:: 2.32
card-next-schedule:: 2022-10-11T10:47:20.304Z
card-last-reviewed:: 2022-10-07T10:47:20.304Z
card-last-score:: 3
- A **Key** is some critical information used by the cipher, known only to the sender & receiver, selected from a **keyspace** (the set of all possible keys).
- What does **Encipher** mean?
card-last-score:: 5
card-repeats:: 3
card-next-schedule:: 2022-10-17T21:14:43.789Z
card-last-interval:: 11.2
card-ease-factor:: 2.8
card-last-reviewed:: 2022-10-06T17:14:43.790Z
- **Enciphering** is the process of converting plaintext into ciphertext using a cipher & a key.
- What does **Decipher** mean?
card-last-interval:: 4
card-repeats:: 2
card-ease-factor:: 2.7
card-next-schedule:: 2022-10-04T12:09:14.829Z
card-last-reviewed:: 2022-09-30T12:09:14.829Z
card-last-score:: 5
- **Deciphering** is the process of converting ciphertext back into plaintext using a cipher & a key.
- What is **Encryption**? #card
card-last-score:: 3
card-repeats:: 3
card-next-schedule:: 2022-10-16T16:40:50.413Z
card-last-interval:: 9.28
card-ease-factor:: 2.32
card-last-reviewed:: 2022-10-07T10:40:50.414Z
- **Encryption** is some mathematical function $E_K()$ mapping plaintext $P$ to ciphertext $C$ using the specified key $K$.
- $$E_K(P) = C$$
- What is **Decryption**? #card
card-last-interval:: -1
card-repeats:: 1
card-ease-factor:: 2.22
card-next-schedule:: 2022-10-08T23:00:00.000Z
card-last-reviewed:: 2022-10-08T15:22:54.739Z
card-last-score:: 1
- **Decryption** is some mathematical function ${E_K}^{-1}()$ mapping the ciphertext $C$ to plaintext $P$ using the specified key $K$.
- $$P={E_K}^{-1}(C)$$
- What is **Cryptanalysis**? #card
card-last-interval:: 11.2
card-repeats:: 3
card-ease-factor:: 2.8
card-next-schedule:: 2022-10-17T21:28:14.325Z
card-last-reviewed:: 2022-10-06T17:28:14.325Z
card-last-score:: 5
- **Cryptanalysis** is the study of principles & methods of transforming an unintelligible message into an intelligible message without knowledge of the key.
- What is **Cryptology**?
card-last-interval:: 9.28
card-repeats:: 3
card-ease-factor:: 2.32
card-next-schedule:: 2022-10-16T16:40:03.776Z
card-last-reviewed:: 2022-10-07T10:40:03.777Z
card-last-score:: 5
- **Cryptology** is the field encompassing both cryptography & cryptanalysis.
-
-
- ## Model of Conventional Cryptosystem
- ![image.png](../assets/image_1663459919021_0.png){:height 304, :width 610}
- ## Cryptanalysis via Letter Frequency Distribution
- Human languages are **redundant** - letters are not equally commonly used.
- In the **English** language:
- **E** is by far the most common letter followed by T, R, N, I, O, A, and S.
- Other letters like Z, J, K, Q, and X are fairly rare.
- Certain letter combinations like **TH** are quite common.
- ![image.png](../assets/image_1663488626792_0.png)
-
- ### C Program for Frequency Analysis of single Characters
- ```c
#include <stdio.h>
#include <string.h>
#include <ctype.h>
int main(int argc, char* argv[]) {
FILE* fp;
int data[26];
char c;
memset(data, 0, siezof(data));
if (argc != 2) {
return(-1);
}
if (fp = fopen(argv[1], "r" == NULL)) {
return(-2);
}
while(!feof(fp)) {
c = toupper(fgetc(fp));
if ((c >= 'A') && (c <= 'Z')) {
data[c-65]++;
}
}
for (int i = 0; i < 26; i++) {
printf("%c:%i\n", i+65, data[i]);
}
fclose(fp);
return(0);
}
```
- ## Known Plaintext Attacks (KPA)
- What is a **Known Plaintext Attack (KPA)**? #card
card-last-interval:: 10.24
card-repeats:: 3
card-ease-factor:: 2.56
card-next-schedule:: 2022-10-16T14:39:41.014Z
card-last-reviewed:: 2022-10-06T09:39:41.014Z
card-last-score:: 5
- The **Known Plaintext Attack (KPA)** is an attack model for cryptanalysis where the attacker has access to both:
- some of, or all of, the plaintext (called a **crib**)
- the ciphertext
-
-
- ## Caesar Cipher
- What is a **Caesar Cipher**? #card
card-last-interval:: 11.2
card-repeats:: 3
card-ease-factor:: 2.8
card-next-schedule:: 2022-10-17T21:27:16.902Z
card-last-reviewed:: 2022-10-06T17:27:16.903Z
card-last-score:: 5
- A **Caesar Cipher** involves using an offset alphabet to encrypt a message.
- We can use any shift from 1 to 25 to replace each plaintext letter with a letter a fixed distance away.
- The **key letter** represents the start of this offset alphabet.
- For example, a key letter of F means that A -> F, B -> G, and so on.
- ## Playfair Cipher
- Not even the large number of keys in a monoalphabetic cipher provides security.
- What is a **monoalphabetic cipher**? #card
card-last-interval:: 10.24
card-repeats:: 3
card-ease-factor:: 2.56
card-next-schedule:: 2022-10-16T22:27:13.914Z
card-last-reviewed:: 2022-10-06T17:27:13.915Z
card-last-score:: 3
- A **monoalphabetic cipher** is any cipher in which the letters of the plaintext are mapped to ciphertext letters based on a single alphabetic key.
- One approach to improving security over monoalphabetic ciphers is to to encrypt ^^multiple letters.^^
- The **Playfair Cipher** is one example of such an approach.
- The algorithm was invented by Charles Wheatstone in 1854, but named after his friend Baron Playfair.
- ### How does the Playfair Cipher work?
card-last-score:: 5
card-repeats:: 2
card-next-schedule:: 2022-10-08T00:33:19.557Z
card-last-interval:: 3.51
card-ease-factor:: 2.6
card-last-reviewed:: 2022-10-04T12:33:19.558Z
- ![image.png](../assets/image_1663491286810_0.png)
- 1. Create a 5x5 grid of letters; insert the keyword as shown, with each letter only considered once; fill the grid with the remaining letters in alphabetic order.
- 2. The letters are then encrypted in pairs.
- 3. Repeats have an "X" inserted.
- BALLOON -> BA LX LO ON
- 4. Letters that fall in the same row are replaced with the letter on the right.
- OK -> GM
- 5. Letters in the same column are replaced with the letter below.
- FO -> OU
- 6. Otherwise, each letter gets replaced by the letter in its row but in the other letters column.
- QM -> TH
- ### Security of the Playfair Cipher
- The security is much improved over simple monoalphabetic ciphers, as the Playfair Cipher has $26^2 = 676$ combinations.
- This requires a 676 entry frequency table to analyse (as compared to a 26 entry frequency table for a monoalphabetic cipher) and correspondingly, more ciphertext.
- However, the Playfair Cipher *can* be cracked through frequency analysis of letter pairs, given a few hundred letters.
-
- ## Vigenère Cipher
- [Blaise de Vigenère](https://en.wikipedia.org/wiki/Blaise_de_Vigen%C3%A8re) is generally credited as the inventor of the **Polyalphabetic Substitution Cipher**.
- What is a **Polyalphabetic Substitution Cipher**? #card
card-last-interval:: 4
card-repeats:: 2
card-ease-factor:: 2.7
card-next-schedule:: 2022-10-11T10:31:42.282Z
card-last-reviewed:: 2022-10-07T10:31:42.283Z
card-last-score:: 5
- A **Polyalphabetic Substitution Cipher** uses multiple substitution alphabets, as opposed to a monoalphabetic cipher which uses a single alphabetic key.
- The Vigenère Cipher improves security by using many monoalphabetic substitution alphabets, so each letter can be replaced by many others.
- You use a **key** to select which alphabet is used for each letter of the message.
- The $i^{th}$ letter of the key specifies the $i^{th}$ alphabet to use.
- Use each alphabet in turn.
- Repeat from the start after the end of the key is reached.
-
- ### Vigenère Steps
- ![image.png](../assets/image_1663494147352_0.png)
- 1. Write the plaintext out, and write the keyword underneath it, repeated, for the length of the plaintext.
- 2. Use each key letter in turn as a Caesar cipher key.
- 3. Encrypt the corresponding plaintext letter.
- In this example, we use the keyword "CIPHER". Hence, we have the following translation alphabets:
- ![image.png](../assets/image_1663494236099_0.png)
- ### How to crack the Vigenère Cipher
- 1. Search the ciphertext for repeated strings of letters - the longer the string, the better.
- 2. For each occurrence of a repeated string, count how many letters are between the first letters in the string, and add one.
- 3. Factorise that number.
- 4. Repeat this process with each repeated string you find and make a table of common factors. The most common factor, $n$ is most likely the length of the keyword used to encipher the ciphertext.
- 5. Do a frequency count on the ciphertext, on every $n^{th}$ letter. You should end up with $n$ different frequency counts.
- 6. Compare these counts to standard frequency tables to figure out how much each letter was shifted by.
- 7. Undo the shifts and read the message.
- ## Enigma (Rotor Ciphers)
- ### Rotor Ciphers
- The mechanisation / automation of encryption.
- An $\text{N}$-stage polyalphabetic algorithm modulo 26.
- $26^N$ steps before a repetition, where $N$ is the number of cylinders.
- The Enigma machine had 5 cylinders, so:
- $$26^{N=5}=11,881,376 \text{ steps}$$
-
- ### Breaking Enigma using **Cribs**
- The starting point for breaking Enigma was based on the following:
- Plaintext messages were likely to contain certain phrases.
- Weather reports contained the term "WETTER VORHERSAGE".
- Military units often sent messages containing "KEINE BESONDEREN EREIGNISSE" ("nothing to report").
- A plaintext letter was never mapped onto the same ciphertext letter.
- While the cryptanalysts in Bletchely Park did not know exactly where these cribs were placed in an intercepted message, they could exclude certain positions.
- ![image.png](../assets/image_1663500888551_0.png)
- From here, possible rotor start positions & rotor wiring would be systematically examined using the "bombe" - an electromechanical device designed by Turing that replicated the action of several Enigma machines wired together.
-
- ## Transposition Ciphers
- What are **Transposition Ciphers**? #card
card-last-interval:: 8.88
card-repeats:: 3
card-ease-factor:: 2.22
card-next-schedule:: 2022-10-16T07:39:25.895Z
card-last-reviewed:: 2022-10-07T10:39:25.895Z
card-last-score:: 3
- **Transposition** or **Permutation Ciphers** hide the message by rearranging the letter order ^^without altering the actual letters used.^^
- This can be recognised since the ciphertext has the same frequency distribution as the original text.
- ### Rail Fence Cipher
- Write plaintext letters out diagonally over a number of rows, then read off the cipher row by row.
- ![image.png](../assets/image_1663501467907_0.png)
- ### Row Transposition Cipher
- What are **Row Transposition Ciphers**? #card
card-last-interval:: 26.21
card-repeats:: 4
card-ease-factor:: 2.56
card-next-schedule:: 2022-11-01T22:18:29.590Z
card-last-reviewed:: 2022-10-06T17:18:29.591Z
card-last-score:: 5
- **Row Transposition Ciphers** are a more complex kind of transposition cipher than Rail Fence Ciphers.
- Plaintext letters are written out in rows over a specified number of columns.
- The columns are then re-ordered according to some key before reading off the columns
- ![image.png](../assets/image_1663501773385_0.png)
-
- ## Product Ciphers
- Ciphers using just substitutions or transpositions are not secure because of language characteristics.
- Consider using several ciphers in succession to make it harder to crack:
- Two substitutions make a more complex substitution.
- Two transpositions make a more complex transposition.
- However, a substitution followed by a transposition makes a much harder cipher.
-
-
- # Steganography
- What is **Steganography**? #card
card-last-interval:: 11.2
card-repeats:: 3
card-ease-factor:: 2.8
card-next-schedule:: 2022-10-20T12:50:18.491Z
card-last-reviewed:: 2022-10-09T08:50:18.492Z
card-last-score:: 5
- **Steganography** is an alternative to encryption that hides the existence of the message.
- For example:
- Using only a subset of letters / words in a message marked in some way.
- Using invisible ink.
- Hiding in LSB in graphic image or sound file.
- The drawback of steganography is that it's not very economical in terms of overheads to hide a message.
-

View File

@ -0,0 +1,316 @@
- #[[CT255 - Next Generation Technologies II]]
- **Previous Topic:** [[GDPR]]
- **Next Topic:** [[Human Security & Passwords]]
- **Relevant Slides:** ![ct255_02.pdf](../assets/ct255_02_1663458790357_0.pdf)
id:: 63265db7-1d41-44f7-b4cf-0bab377a7c1c
-
- ## SQL Injections
- What is an **SQL Injection**? #card
card-last-interval:: 10.6
card-repeats:: 3
card-ease-factor:: 2.56
card-next-schedule:: 2022-10-19T12:58:54.850Z
card-last-reviewed:: 2022-10-08T22:58:54.851Z
card-last-score:: 5
-
- An **SQL Injection** is a ***code injection technique*** used to attack data-driven applications, in which malicious SQL statements are inserted for execution.
- It is a way of exploiting user input & SQL statements to compromise the database & retrieve sensitive data.
-
- ## Basic Terminology
- What is **Cryptography**? #card
card-last-interval:: 33.64
card-repeats:: 4
card-ease-factor:: 2.9
card-next-schedule:: 2022-11-10T01:19:02.918Z
card-last-reviewed:: 2022-10-07T10:19:02.918Z
card-last-score:: 5
- **Cryptography** is the art of encompassing the principles & methods of transforming an intelligible message into one that is unintelligible, and then retransforming that message back into its original form.
- What is **Plaintext**?
card-last-score:: 5
card-repeats:: 3
card-next-schedule:: 2022-10-17T21:24:55.999Z
card-last-interval:: 11.2
card-ease-factor:: 2.8
card-last-reviewed:: 2022-10-06T17:24:55.999Z
- **Plaintext** is the ^^original, intelligible message.^^
- What is **Ciphertext**?
card-last-interval:: 11.2
card-repeats:: 3
card-ease-factor:: 2.8
card-next-schedule:: 2022-10-18T14:39:00.206Z
card-last-reviewed:: 2022-10-07T10:39:00.207Z
card-last-score:: 5
- **Ciphertext** is the encrypted messsage.
- What is a **Cipher**? #card
card-last-interval:: 4.14
card-repeats:: 2
card-ease-factor:: 2.56
card-next-schedule:: 2022-10-13T01:43:58.055Z
card-last-reviewed:: 2022-10-08T22:43:58.056Z
card-last-score:: 5
- A **Cipher** is an algorithm for transforming an intelligible message into one that is unintelligible.
- What is a **Key**? #card
card-last-interval:: 4
card-repeats:: 2
card-ease-factor:: 2.32
card-next-schedule:: 2022-10-11T10:47:20.304Z
card-last-reviewed:: 2022-10-07T10:47:20.304Z
card-last-score:: 3
- A **Key** is some critical information used by the cipher, known only to the sender & receiver, selected from a **keyspace** (the set of all possible keys).
- What does **Encipher** mean?
card-last-score:: 5
card-repeats:: 3
card-next-schedule:: 2022-10-17T21:14:43.789Z
card-last-interval:: 11.2
card-ease-factor:: 2.8
card-last-reviewed:: 2022-10-06T17:14:43.790Z
- **Enciphering** is the process of converting plaintext into ciphertext using a cipher & a key.
- What does **Decipher** mean?
card-last-interval:: 4
card-repeats:: 2
card-ease-factor:: 2.7
card-next-schedule:: 2022-10-04T12:09:14.829Z
card-last-reviewed:: 2022-09-30T12:09:14.829Z
card-last-score:: 5
- **Deciphering** is the process of converting ciphertext back into plaintext using a cipher & a key.
- What is **Encryption**? #card
card-last-score:: 3
card-repeats:: 3
card-next-schedule:: 2022-10-16T16:40:50.413Z
card-last-interval:: 9.28
card-ease-factor:: 2.32
card-last-reviewed:: 2022-10-07T10:40:50.414Z
- **Encryption** is some mathematical function $E_K()$ mapping plaintext $P$ to ciphertext $C$ using the specified key $K$.
- $$E_K(P) = C$$
- What is **Decryption**? #card
card-last-interval:: 4
card-repeats:: 2
card-ease-factor:: 2.32
card-next-schedule:: 2022-10-14T11:37:04.045Z
card-last-reviewed:: 2022-10-10T11:37:04.046Z
card-last-score:: 5
- **Decryption** is some mathematical function ${E_K}^{-1}()$ mapping the ciphertext $C$ to plaintext $P$ using the specified key $K$.
- $$P={E_K}^{-1}(C)$$
- What is **Cryptanalysis**? #card
card-last-interval:: 28.3
card-repeats:: 4
card-ease-factor:: 2.66
card-next-schedule:: 2022-11-16T15:43:11.780Z
card-last-reviewed:: 2022-10-19T08:43:11.781Z
card-last-score:: 3
- **Cryptanalysis** is the study of principles & methods of transforming an unintelligible message into an intelligible message without knowledge of the key.
- What is **Cryptology**?
card-last-interval:: 9.28
card-repeats:: 3
card-ease-factor:: 2.32
card-next-schedule:: 2022-10-16T16:40:03.776Z
card-last-reviewed:: 2022-10-07T10:40:03.777Z
card-last-score:: 5
- **Cryptology** is the field encompassing both cryptography & cryptanalysis.
-
-
- ## Model of Conventional Cryptosystem
- ![image.png](../assets/image_1663459919021_0.png){:height 304, :width 610}
- ## Cryptanalysis via Letter Frequency Distribution
- Human languages are **redundant** - letters are not equally commonly used.
- In the **English** language:
- **E** is by far the most common letter followed by T, R, N, I, O, A, and S.
- Other letters like Z, J, K, Q, and X are fairly rare.
- Certain letter combinations like **TH** are quite common.
- ![image.png](../assets/image_1663488626792_0.png)
-
- ### C Program for Frequency Analysis of single Characters
- ```c
#include <stdio.h>
#include <string.h>
#include <ctype.h>
int main(int argc, char* argv[]) {
FILE* fp;
int data[26];
char c;
memset(data, 0, siezof(data));
if (argc != 2) {
return(-1);
}
if (fp = fopen(argv[1], "r" == NULL)) {
return(-2);
}
while(!feof(fp)) {
c = toupper(fgetc(fp));
if ((c >= 'A') && (c <= 'Z')) {
data[c-65]++;
}
}
for (int i = 0; i < 26; i++) {
printf("%c:%i\n", i+65, data[i]);
}
fclose(fp);
return(0);
}
```
- ## Known Plaintext Attacks (KPA)
- What is a **Known Plaintext Attack (KPA)**? #card
card-last-interval:: 10.24
card-repeats:: 3
card-ease-factor:: 2.56
card-next-schedule:: 2022-10-16T14:39:41.014Z
card-last-reviewed:: 2022-10-06T09:39:41.014Z
card-last-score:: 5
- The **Known Plaintext Attack (KPA)** is an attack model for cryptanalysis where the attacker has access to both:
- some of, or all of, the plaintext (called a **crib**)
- the ciphertext
-
-
- ## Caesar Cipher
- What is a **Caesar Cipher**? #card
card-last-interval:: 11.2
card-repeats:: 3
card-ease-factor:: 2.8
card-next-schedule:: 2022-10-17T21:27:16.902Z
card-last-reviewed:: 2022-10-06T17:27:16.903Z
card-last-score:: 5
- A **Caesar Cipher** involves using an offset alphabet to encrypt a message.
- We can use any shift from 1 to 25 to replace each plaintext letter with a letter a fixed distance away.
- The **key letter** represents the start of this offset alphabet.
- For example, a key letter of F means that A -> F, B -> G, and so on.
- ## Playfair Cipher
- Not even the large number of keys in a monoalphabetic cipher provides security.
- What is a **monoalphabetic cipher**? #card
card-last-interval:: 10.24
card-repeats:: 3
card-ease-factor:: 2.56
card-next-schedule:: 2022-10-16T22:27:13.914Z
card-last-reviewed:: 2022-10-06T17:27:13.915Z
card-last-score:: 3
- A **monoalphabetic cipher** is any cipher in which the letters of the plaintext are mapped to ciphertext letters based on a single alphabetic key.
- One approach to improving security over monoalphabetic ciphers is to to encrypt ^^multiple letters.^^
- The **Playfair Cipher** is one example of such an approach.
- The algorithm was invented by Charles Wheatstone in 1854, but named after his friend Baron Playfair.
- ### How does the Playfair Cipher work?
card-last-score:: 5
card-repeats:: 2
card-next-schedule:: 2022-10-08T00:33:19.557Z
card-last-interval:: 3.51
card-ease-factor:: 2.6
card-last-reviewed:: 2022-10-04T12:33:19.558Z
- ![image.png](../assets/image_1663491286810_0.png)
- 1. Create a 5x5 grid of letters; insert the keyword as shown, with each letter only considered once; fill the grid with the remaining letters in alphabetic order.
- 2. The letters are then encrypted in pairs.
- 3. Repeats have an "X" inserted.
- BALLOON -> BA LX LO ON
- 4. Letters that fall in the same row are replaced with the letter on the right.
- OK -> GM
- 5. Letters in the same column are replaced with the letter below.
- FO -> OU
- 6. Otherwise, each letter gets replaced by the letter in its row but in the other letters column.
- QM -> TH
- ### Security of the Playfair Cipher
- The security is much improved over simple monoalphabetic ciphers, as the Playfair Cipher has $26^2 = 676$ combinations.
- This requires a 676 entry frequency table to analyse (as compared to a 26 entry frequency table for a monoalphabetic cipher) and correspondingly, more ciphertext.
- However, the Playfair Cipher *can* be cracked through frequency analysis of letter pairs, given a few hundred letters.
-
- ## Vigenère Cipher
- [Blaise de Vigenère](https://en.wikipedia.org/wiki/Blaise_de_Vigen%C3%A8re) is generally credited as the inventor of the **Polyalphabetic Substitution Cipher**.
- What is a **Polyalphabetic Substitution Cipher**? #card
card-last-interval:: 4
card-repeats:: 2
card-ease-factor:: 2.7
card-next-schedule:: 2022-10-11T10:31:42.282Z
card-last-reviewed:: 2022-10-07T10:31:42.283Z
card-last-score:: 5
- A **Polyalphabetic Substitution Cipher** uses multiple substitution alphabets, as opposed to a monoalphabetic cipher which uses a single alphabetic key.
- The Vigenère Cipher improves security by using many monoalphabetic substitution alphabets, so each letter can be replaced by many others.
- You use a **key** to select which alphabet is used for each letter of the message.
- The $i^{th}$ letter of the key specifies the $i^{th}$ alphabet to use.
- Use each alphabet in turn.
- Repeat from the start after the end of the key is reached.
-
- ### Vigenère Steps
- ![image.png](../assets/image_1663494147352_0.png)
- 1. Write the plaintext out, and write the keyword underneath it, repeated, for the length of the plaintext.
- 2. Use each key letter in turn as a Caesar cipher key.
- 3. Encrypt the corresponding plaintext letter.
- In this example, we use the keyword "CIPHER". Hence, we have the following translation alphabets:
- ![image.png](../assets/image_1663494236099_0.png)
- ### How to crack the Vigenère Cipher
- 1. Search the ciphertext for repeated strings of letters - the longer the string, the better.
- 2. For each occurrence of a repeated string, count how many letters are between the first letters in the string, and add one.
- 3. Factorise that number.
- 4. Repeat this process with each repeated string you find and make a table of common factors. The most common factor, $n$ is most likely the length of the keyword used to encipher the ciphertext.
- 5. Do a frequency count on the ciphertext, on every $n^{th}$ letter. You should end up with $n$ different frequency counts.
- 6. Compare these counts to standard frequency tables to figure out how much each letter was shifted by.
- 7. Undo the shifts and read the message.
- ## Enigma (Rotor Ciphers)
- ### Rotor Ciphers
- The mechanisation / automation of encryption.
- An $\text{N}$-stage polyalphabetic algorithm modulo 26.
- $26^N$ steps before a repetition, where $N$ is the number of cylinders.
- The Enigma machine had 5 cylinders, so:
- $$26^{N=5}=11,881,376 \text{ steps}$$
-
- ### Breaking Enigma using **Cribs**
- The starting point for breaking Enigma was based on the following:
- Plaintext messages were likely to contain certain phrases.
- Weather reports contained the term "WETTER VORHERSAGE".
- Military units often sent messages containing "KEINE BESONDEREN EREIGNISSE" ("nothing to report").
- A plaintext letter was never mapped onto the same ciphertext letter.
- While the cryptanalysts in Bletchely Park did not know exactly where these cribs were placed in an intercepted message, they could exclude certain positions.
- ![image.png](../assets/image_1663500888551_0.png)
- From here, possible rotor start positions & rotor wiring would be systematically examined using the "bombe" - an electromechanical device designed by Turing that replicated the action of several Enigma machines wired together.
-
- ## Transposition Ciphers
- What are **Transposition Ciphers**? #card
card-last-interval:: 8.88
card-repeats:: 3
card-ease-factor:: 2.22
card-next-schedule:: 2022-10-16T07:39:25.895Z
card-last-reviewed:: 2022-10-07T10:39:25.895Z
card-last-score:: 3
- **Transposition** or **Permutation Ciphers** hide the message by rearranging the letter order ^^without altering the actual letters used.^^
- This can be recognised since the ciphertext has the same frequency distribution as the original text.
- ### Rail Fence Cipher
- Write plaintext letters out diagonally over a number of rows, then read off the cipher row by row.
- ![image.png](../assets/image_1663501467907_0.png)
- ### Row Transposition Cipher
- What are **Row Transposition Ciphers**? #card
card-last-interval:: 26.21
card-repeats:: 4
card-ease-factor:: 2.56
card-next-schedule:: 2022-11-01T22:18:29.590Z
card-last-reviewed:: 2022-10-06T17:18:29.591Z
card-last-score:: 5
- **Row Transposition Ciphers** are a more complex kind of transposition cipher than Rail Fence Ciphers.
- Plaintext letters are written out in rows over a specified number of columns.
- The columns are then re-ordered according to some key before reading off the columns
- ![image.png](../assets/image_1663501773385_0.png)
-
- ## Product Ciphers
- Ciphers using just substitutions or transpositions are not secure because of language characteristics.
- Consider using several ciphers in succession to make it harder to crack:
- Two substitutions make a more complex substitution.
- Two transpositions make a more complex transposition.
- However, a substitution followed by a transposition makes a much harder cipher.
-
-
- # Steganography
- What is **Steganography**? #card
card-last-interval:: 11.2
card-repeats:: 3
card-ease-factor:: 2.8
card-next-schedule:: 2022-10-20T12:50:18.491Z
card-last-reviewed:: 2022-10-09T08:50:18.492Z
card-last-score:: 5
- **Steganography** is an alternative to encryption that hides the existence of the message.
- For example:
- Using only a subset of letters / words in a message marked in some way.
- Using invisible ink.
- Hiding in LSB in graphic image or sound file.
- The drawback of steganography is that it's not very economical in terms of overheads to hide a message.
-

View File

@ -0,0 +1,317 @@
- #[[CT255 - Next Generation Technologies II]]
- **Previous Topic:** [[GDPR]]
- **Next Topic:** [[Human Security & Passwords]]
- **Relevant Slides:** ![ct255_02.pdf](../assets/ct255_02_1663458790357_0.pdf)
id:: 63265db7-1d41-44f7-b4cf-0bab377a7c1c
-
- ## SQL Injections
- What is an **SQL Injection**? #card
card-last-interval:: 10.6
card-repeats:: 3
card-ease-factor:: 2.56
card-next-schedule:: 2022-10-19T12:58:54.850Z
card-last-reviewed:: 2022-10-08T22:58:54.851Z
card-last-score:: 5
-
- An **SQL Injection** is a ***code injection technique*** used to attack data-driven applications, in which malicious SQL statements are inserted for execution.
- It is a way of exploiting user input & SQL statements to compromise the database & retrieve sensitive data.
-
- ## Basic Terminology
- What is **Cryptography**? #card
card-last-interval:: 33.64
card-repeats:: 4
card-ease-factor:: 2.9
card-next-schedule:: 2022-11-10T01:19:02.918Z
card-last-reviewed:: 2022-10-07T10:19:02.918Z
card-last-score:: 5
- **Cryptography** is the art of encompassing the principles & methods of transforming an intelligible message into one that is unintelligible, and then retransforming that message back into its original form.
- What is **Plaintext**?
card-last-score:: 5
card-repeats:: 3
card-next-schedule:: 2022-10-17T21:24:55.999Z
card-last-interval:: 11.2
card-ease-factor:: 2.8
card-last-reviewed:: 2022-10-06T17:24:55.999Z
- **Plaintext** is the ^^original, intelligible message.^^
- What is **Ciphertext**?
card-last-interval:: 11.2
card-repeats:: 3
card-ease-factor:: 2.8
card-next-schedule:: 2022-10-18T14:39:00.206Z
card-last-reviewed:: 2022-10-07T10:39:00.207Z
card-last-score:: 5
- **Ciphertext** is the encrypted messsage.
- What is a **Cipher**? #card
card-last-interval:: 4.14
card-repeats:: 2
card-ease-factor:: 2.56
card-next-schedule:: 2022-10-13T01:43:58.055Z
card-last-reviewed:: 2022-10-08T22:43:58.056Z
card-last-score:: 5
- A **Cipher** is an algorithm for transforming an intelligible message into one that is unintelligible.
- What is a **Key**? #card
card-last-interval:: 4
card-repeats:: 2
card-ease-factor:: 2.32
card-next-schedule:: 2022-10-11T10:47:20.304Z
card-last-reviewed:: 2022-10-07T10:47:20.304Z
card-last-score:: 3
- A **Key** is some critical information used by the cipher, known only to the sender & receiver, selected from a **keyspace** (the set of all possible keys).
- What does **Encipher** mean?
card-last-score:: 5
card-repeats:: 3
card-next-schedule:: 2022-10-17T21:14:43.789Z
card-last-interval:: 11.2
card-ease-factor:: 2.8
card-last-reviewed:: 2022-10-06T17:14:43.790Z
- **Enciphering** is the process of converting plaintext into ciphertext using a cipher & a key.
- What does **Decipher** mean?
card-last-interval:: 4
card-repeats:: 2
card-ease-factor:: 2.7
card-next-schedule:: 2022-10-04T12:09:14.829Z
card-last-reviewed:: 2022-09-30T12:09:14.829Z
card-last-score:: 5
- **Deciphering** is the process of converting ciphertext back into plaintext using a cipher & a key.
- What is **Encryption**? #card
card-last-score:: 3
card-repeats:: 3
card-next-schedule:: 2022-10-16T16:40:50.413Z
card-last-interval:: 9.28
card-ease-factor:: 2.32
card-last-reviewed:: 2022-10-07T10:40:50.414Z
- **Encryption** is some mathematical function $E_K()$ mapping plaintext $P$ to ciphertext $C$ using the specified key $K$.
- $$E_K(P) = C$$
- What is **Decryption**? #card
card-last-interval:: 4
card-repeats:: 2
card-ease-factor:: 2.32
card-next-schedule:: 2022-10-14T11:37:04.045Z
card-last-reviewed:: 2022-10-10T11:37:04.046Z
card-last-score:: 5
- **Decryption** is some mathematical function ${E_K}^{-1}()$ mapping the ciphertext $C$ to plaintext $P$ using the specified key $K$.
- $$P={E_K}^{-1}(C)$$
- What is **Cryptanalysis**? #card
card-last-interval:: 28.3
card-repeats:: 4
card-ease-factor:: 2.66
card-next-schedule:: 2022-11-16T15:43:11.780Z
card-last-reviewed:: 2022-10-19T08:43:11.781Z
card-last-score:: 3
- **Cryptanalysis** is the study of principles & methods of transforming an unintelligible message into an intelligible message without knowledge of the key.
- What is **Cryptology**?
card-last-interval:: 9.28
card-repeats:: 3
card-ease-factor:: 2.32
card-next-schedule:: 2022-10-16T16:40:03.776Z
card-last-reviewed:: 2022-10-07T10:40:03.777Z
card-last-score:: 5
- **Cryptology** is the field encompassing both cryptography & cryptanalysis.
-
-
- ## Model of Conventional Cryptosystem
- ![image.png](../assets/image_1663459919021_0.png){:height 304, :width 610}
- ## Cryptanalysis via Letter Frequency Distribution
- Human languages are **redundant** - letters are not equally commonly used.
- In the **English** language:
- **E** is by far the most common letter followed by T, R, N, I, O, A, and S.
- Other letters like Z, J, K, Q, and X are fairly rare.
- Certain letter combinations like **TH** are quite common.
- ![image.png](../assets/image_1663488626792_0.png)
-
- ### C Program for Frequency Analysis of single Characters
- ```c
#include <stdio.h>
#include <string.h>
#include <ctype.h>
int main(int argc, char* argv[]) {
FILE* fp;
int data[26];
char c;
memset(data, 0, siezof(data));
if (argc != 2) {
return(-1);
}
if (fp = fopen(argv[1], "r" == NULL)) {
return(-2);
}
while(!feof(fp)) {
c = toupper(fgetc(fp));
if ((c >= 'A') && (c <= 'Z')) {
data[c-65]++;
}
}
for (int i = 0; i < 26; i++) {
printf("%c:%i\n", i+65, data[i]);
}
fclose(fp);
return(0);
}
```
- ## Known Plaintext Attacks (KPA)
- What is a **Known Plaintext Attack (KPA)**? #card
card-last-interval:: 10.24
card-repeats:: 3
card-ease-factor:: 2.56
card-next-schedule:: 2022-10-16T14:39:41.014Z
card-last-reviewed:: 2022-10-06T09:39:41.014Z
card-last-score:: 5
- The **Known Plaintext Attack (KPA)** is an attack model for cryptanalysis where the attacker has access to both:
- some of, or all of, the plaintext (called a **crib**)
- the ciphertext
-
-
- ## Caesar Cipher
- What is a **Caesar Cipher**? #card
card-last-interval:: 11.2
card-repeats:: 3
card-ease-factor:: 2.8
card-next-schedule:: 2022-10-17T21:27:16.902Z
card-last-reviewed:: 2022-10-06T17:27:16.903Z
card-last-score:: 5
- A **Caesar Cipher** involves using an offset alphabet to encrypt a message.
- We can use any shift from 1 to 25 to replace each plaintext letter with a letter a fixed distance away.
- The **key letter** represents the start of this offset alphabet.
- For example, a key letter of F means that A -> F, B -> G, and so on.
- ## Playfair Cipher
- Not even the large number of keys in a monoalphabetic cipher provides security.
- What is a **monoalphabetic cipher**? #card
card-last-interval:: 10.24
card-repeats:: 3
card-ease-factor:: 2.56
card-next-schedule:: 2022-10-16T22:27:13.914Z
card-last-reviewed:: 2022-10-06T17:27:13.915Z
card-last-score:: 3
- A **monoalphabetic cipher** is any cipher in which the letters of the plaintext are mapped to ciphertext letters based on a single alphabetic key.
- One approach to improving security over monoalphabetic ciphers is to to encrypt ^^multiple letters.^^
- The **Playfair Cipher** is one example of such an approach.
- The algorithm was invented by Charles Wheatstone in 1854, but named after his friend Baron Playfair.
- ### How does the Playfair Cipher work?
card-last-score:: 5
card-repeats:: 2
card-next-schedule:: 2022-10-08T00:33:19.557Z
card-last-interval:: 3.51
card-ease-factor:: 2.6
card-last-reviewed:: 2022-10-04T12:33:19.558Z
- ![image.png](../assets/image_1663491286810_0.png)
- 1. Create a 5x5 grid of letters; insert the keyword as shown, with each letter only considered once; fill the grid with the remaining letters in alphabetic order.
- 2. The letters are then encrypted in pairs.
- 3. Repeats have an "X" inserted.
- BALLOON -> BA LX LO ON
- 4. Letters that fall in the same row are replaced with the letter on the right.
- OK -> GM
- 5. Letters in the same column are replaced with the letter below.
- FO -> OU
- 6. Otherwise, each letter gets replaced by the letter in its row but in the other letters column.
- QM -> TH
- ### Security of the Playfair Cipher
- The security is much improved over simple monoalphabetic ciphers, as the Playfair Cipher has $26^2 = 676$ combinations.
- This requires a 676 entry frequency table to analyse (as compared to a 26 entry frequency table for a monoalphabetic cipher) and correspondingly, more ciphertext.
- However, the Playfair Cipher *can* be cracked through frequency analysis of letter pairs, given a few hundred letters.
-
- ## Vigenère Cipher
- [Blaise de Vigenère](https://en.wikipedia.org/wiki/Blaise_de_Vigen%C3%A8re) is generally credited as the inventor of the **Polyalphabetic Substitution Cipher**.
- What is a **Polyalphabetic Substitution Cipher**? #card
card-last-interval:: 4
card-repeats:: 2
card-ease-factor:: 2.7
card-next-schedule:: 2022-10-11T10:31:42.282Z
card-last-reviewed:: 2022-10-07T10:31:42.283Z
card-last-score:: 5
- A **Polyalphabetic Substitution Cipher** uses multiple substitution alphabets, as opposed to a monoalphabetic cipher which uses a single alphabetic key.
- The Vigenère Cipher improves security by using many monoalphabetic substitution alphabets, so each letter can be replaced by many others.
- You use a **key** to select which alphabet is used for each letter of the message.
- The $i^{th}$ letter of the key specifies the $i^{th}$ alphabet to use.
- Use each alphabet in turn.
- Repeat from the start after the end of the key is reached.
-
- ### Vigenère Steps
- ![image.png](../assets/image_1663494147352_0.png)
- 1. Write the plaintext out, and write the keyword underneath it, repeated, for the length of the plaintext.
- 2. Use each key letter in turn as a Caesar cipher key.
- 3. Encrypt the corresponding plaintext letter.
- In this example, we use the keyword "CIPHER". Hence, we have the following translation alphabets:
- ![image.png](../assets/image_1663494236099_0.png)
- ### How to crack the Vigenère Cipher
- 1. Search the ciphertext for repeated strings of letters - the longer the string, the better.
- 2. For each occurrence of a repeated string, count how many letters are between the first letters in the string, and add one.
- 3. Factorise that number.
- 4. Repeat this process with each repeated string you find and make a table of common factors. The most common factor, $n$ is most likely the length of the keyword used to encipher the ciphertext.
- 5. Do a frequency count on the ciphertext, on every $n^{th}$ letter. You should end up with $n$ different frequency counts.
- 6. Compare these counts to standard frequency tables to figure out how much each letter was shifted by.
- 7. Undo the shifts and read the message.
- ## Enigma (Rotor Ciphers)
- ### Rotor Ciphers
- The mechanisation / automation of encryption.
- An $\text{N}$-stage polyalphabetic algorithm modulo 26.
- $26^N$ steps before a repetition, where $N$ is the number of cylinders.
- The Enigma machine had 5 cylinders, so:
- $$26^{N=5}=11,881,376 \text{ steps}$$
-
- ### Breaking Enigma using **Cribs**
- The starting point for breaking Enigma was based on the following:
- Plaintext messages were likely to contain certain phrases.
- Weather reports contained the term "WETTER VORHERSAGE".
- Military units often sent messages containing "KEINE BESONDEREN EREIGNISSE" ("nothing to report").
- A plaintext letter was never mapped onto the same ciphertext letter.
- While the cryptanalysts in Bletchely Park did not know exactly where these cribs were placed in an intercepted message, they could exclude certain positions.
- ![image.png](../assets/image_1663500888551_0.png)
- From here, possible rotor start positions & rotor wiring would be systematically examined using the "bombe" - an electromechanical device designed by Turing that replicated the action of several Enigma machines wired together.
-
- ## Transposition Ciphers
- What are **Transposition Ciphers**? #card
card-last-interval:: 8.88
card-repeats:: 3
card-ease-factor:: 2.22
card-next-schedule:: 2022-10-16T07:39:25.895Z
card-last-reviewed:: 2022-10-07T10:39:25.895Z
card-last-score:: 3
- **Transposition** or **Permutation Ciphers** hide the message by rearranging the letter order ^^without altering the actual letters used.^^
- This can be recognised since the ciphertext has the same frequency distribution as the original text.
- ### Rail Fence Cipher
id:: 6344093b-2f4f-4c58-95e4-39a8b30d16c3
- Write plaintext letters out diagonally over a number of rows, then read off the cipher row by row.
- ![image.png](../assets/image_1663501467907_0.png)
- ### Row Transposition Cipher
- What are **Row Transposition Ciphers**? #card
card-last-interval:: 26.21
card-repeats:: 4
card-ease-factor:: 2.56
card-next-schedule:: 2022-11-01T22:18:29.590Z
card-last-reviewed:: 2022-10-06T17:18:29.591Z
card-last-score:: 5
- **Row Transposition Ciphers** are a more complex kind of transposition cipher than ((6344093b-2f4f-4c58-95e4-39a8b30d16c3))s.
- Plaintext letters are written out in rows over a specified number of columns.
- The columns are then re-ordered according to some key before reading off the columns
- ![image.png](../assets/image_1663501773385_0.png)
-
- ## Product Ciphers
- Ciphers using just substitutions or transpositions are not secure because of language characteristics.
- Consider using several ciphers in succession to make it harder to crack:
- Two substitutions make a more complex substitution.
- Two transpositions make a more complex transposition.
- However, a substitution followed by a transposition makes a much harder cipher.
-
-
- # Steganography
- What is **Steganography**? #card
card-last-interval:: 11.2
card-repeats:: 3
card-ease-factor:: 2.8
card-next-schedule:: 2022-10-20T12:50:18.491Z
card-last-reviewed:: 2022-10-09T08:50:18.492Z
card-last-score:: 5
- **Steganography** is an alternative to encryption that hides the existence of the message.
- For example:
- Using only a subset of letters / words in a message marked in some way.
- Using invisible ink.
- Hiding in LSB in graphic image or sound file.
- The drawback of steganography is that it's not very economical in terms of overheads to hide a message.
-