# Cryptanalysis

## Goals

* **Discover original plaintext.**
  * Which originated a given ciphertext.
* **Discover a cipher key.**
  * Allows the decryption of ciphertexts created with the same key.
* **Discover the cipher algorithm.**
  * Or and equivalent algorithm.
  * Usually algorithms are not secret, but there are exceptions.
    * Lorenz, A5 (GSM), RC4 (WEP), Crypto-1 (Mifare)
    * Algorithms for DRM (Digital Rights Management)
  * Reverse engineering.

## Attacks

### Approaches

<figure><img src="https://3450804385-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRIg06sTkCh60KyuJiT39%2Fuploads%2FUmztjdmr99N51RpybONe%2F2023-09-16_09-55.png?alt=media&#x26;token=e73c5a31-3d17-4a18-a2bf-638b500105ef" alt=""><figcaption></figcaption></figure>

#### Brute force

Exhaustive search along the key space until finding a sutable key.

Usually infeasible for a large key space.

* e.g. 2¹²⁸ random keys (or keys with 128 bits).
* Randomness is fundamental!

#### Cleaver attacks

Reduce the search space to a smaller set of potential candidates.
