-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9417848
commit 4358bc1
Showing
2 changed files
with
78 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
--- | ||
sidebar_custom_props: | ||
source: | ||
name: rothe.io | ||
ref: https://rothe.io/?b=crypto&p=353789 | ||
--- | ||
|
||
# XOR-Verschlüsselung | ||
Da wir nun mit Bits arbeiten und nicht mehr mit Buchstaben, müssen wir nach anderen Möglichkeiten zur Verschlüsselung suchen. Alphabetverschiebungen wie bei Caesar und Substitutionen sind nicht mehr geeignete Mittel, wenn nur die Zahlen `0` und `1` zur Verfügung stehen. | ||
|
||
Nebst den bekannten Operationen, *Addition, Subtraktion, Multiplikation und Division* kann ein Computer auch noch weitere Operationen auf zwei Binärzahlen anwenden. Eine solche Operation ist das **XOR** (*exklusives Oder*, *exclusive OR*): | ||
|
||
> Das _exklusive Oder_ ist eine logische Operation, die genau dann $1$ ergibt, wenn genau eines der beiden Argument $1$ ist. | ||
XOR kann auch zur Verschlüsselung verwendet werden. Dabei wird jeweils 1 Bit des Klartextes mit einem Bit des Schlüssels verrechnet. Das Ergebnis ist 1 Bit des Geheimtextes. | ||
|
||
Die Wahrheitstabelle[^1] sieht folgendermassen aus: | ||
|
||
::::Tiles{preventGrowOnHover="true" layout="large"} | ||
:::Tile[Verschlüsselung] | ||
<div className="table-full-width"> | ||
| *p* | *k* | *c* = *p* **XOR** *k* | | ||
| :---: | :---: | :-------------------: | | ||
| 0 | 0 | 0 | | ||
| 0 | 1 | 1 | | ||
| 1 | 0 | 1 | | ||
| 1 | 1 | 0 | | ||
</div> | ||
|
||
p: *plain text* (Klartext) <br/> | ||
k: *key* (Schlüssel) <br/> | ||
c: *cipher* (Verschlüsselt) | ||
::: | ||
|
||
:::Tile[Entschlüsselung] | ||
<div className="table-full-width"> | ||
| *c* | *k* | *p* = *c* **XOR** *k* | | ||
| :---: | :---: | :-------------------: | | ||
| 0 | 0 | 0 | | ||
| 1 | 1 | 0 | | ||
| 1 | 0 | 1 | | ||
| 0 | 1 | 1 | | ||
</div> | ||
::: | ||
:::: | ||
|
||
## Bezug zu ROT13 | ||
Analog zu [ROT13](../Antike/Caesar#rot13) gilt auch hier: Die Verschlüsselung ist identisch mit der Entschlüsselung, da folgendes gilt: | ||
|
||
$$c \text{ XOR } k = (p \text{ XOR } k) \text{ XOR } k = p$$ | ||
|
||
Dies können Sie mit den Tabellen oben leicht überprüfen. | ||
|
||
[^1]: Wenn wir mit Bits rechnen, können wir die Ergebnisse einer mathematischen Operation (Addition, Substraktion, XOR, etc) als Tabelle darstellen. Eine solche Tabelle nennen wir eine _Wahrheitstabelle_. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters