# Key stream reconstruction

As the only encrypted part is the Initialization vector, if for any reason the user can get this value, it's possible to reconstruct the key stream and then break the entire cipher .

## Exploitation

Remember, `ciphertext = plaintext ⊕ encrypt(iv)` so, only from ciphertext is not direclty possible to reconstruct the key stream.

However, if the user can cipher arbitrary plaintext using a same IV, then he know 2 parts of the xor operation and then he can retrieve the `encrypt(iv)` value as explained [here](/cryptography/misc/xor.md#properties).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://www.ctfrecipes.com/cryptography/symmetric-cryptography/aes/mode-of-operation/ofb/key-stream-reconstruction.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
