Testvektoren für die T-310; BArch*442
Die Umsetzung in C in Anwendung der folgenden Beschreibung.
Der verwendete LZS ist die №:31
P = (7, 4, 33, 30, 18, 36, 5, 35, 9, 16, 23, 26, 32, 12,
21, 1, 13, 25, 20, 8, 24, 15, 22, 29, 10, 28, 6)
D = (0, 16, 4, 24, 12, 28, 32, 36, 20)
α = 2
Damit ergibt sich folgendes Gleichungssystem für die Abbildung
φ(s1, s2, f) :
Y1 = s1 + f + Z0 + u36 + Z1 + u32 + s2 + Z2 + u8 + Z3 + u6
Y5 = u16 + f + Z0 + u36 + Z1 + u32 + s2 + Z2 + u8 + Z3
Y9 = u4 + f + Z0 + u36 + Z1 + u32 + s2 + Z2 + u8
Y13 = u24 + f + Z0 + u36 + Z1 + u32 + s2 + Z2
Y17 = u12 + f + Z0 + u36 + Z1 + u32
Y21 = u28 + f + Z0 + u36 + Z1
Y25 = u32 + f + Z0 + u36
Y29 = u36 + f + Z0
Y33 = u20 + f
∀ i ∈ 1,9:
Y4i-3 = uDi + T10-i(f,s2,uP1, …, uP27)
Y4i-2 = u4i-3
Y4i-1 = u4i-2
Y4i = u4i-1
wobei
Z0 = Z(s2 , u7 , u4 , u33, u30, u18)
Z1 = Z(u5 , u35, u9 , u16, u23, u26)
Z2 = Z(u12, u21, u1 , u13, u25, u20)
Z3 = Z(u24, u15, u22, u29, u10, u28)
Prüffolgen:
Sämtliche Prüffolgen wurden mit folgenden Schlüsseln erzeugt:
0101, 0010, 1001, 0100, 1101, 0101,
1010, 0010, 0111, 0100, 1010, 1100,
1111, 0110, 0111, 1111, 0000, 1111,
0110, 0001, 0001, 0001, 1110, 1101,
0111, 1000, 1110, 0010, 0010, 1100)
1101, 0011, 0111, 1001, 1101, 1001,
0000, 0101, 0111, 0000, 1101, 0010,
1011, 0001, 0001, 1010, 1101, 1011,
1110, 0111, 0100, 1000, 1110, 0101,
1010, 0110, 0110, 1111, 0011, 0001)
(f | i | ) | 0 | = (0001, 0000, 0101, 1111, 1111, 0101, 0011, 1010, 0110, 0111, 0100, 0000, 0001, 1111, 1111, 1) |
| i=-60 |
SYF = (f | i | ) | 0 | ( | 0111, 0000, 1001, 0100, 1000, 0010, 1100, 0101, 1000, 1001, 0100, 1000, 1001, 1110, 1101, 1111, | ) |
| i=124 | 0001, 0000, 0101, 1111, 1111, 0101, 0011, 1010, 0110, 0111, 0100, 0000, 0001, 1111, 1111, 1 |
// SYF ist berechnet aus f. |
U0 entspricht dem in der T-310 Definition vorgegebenen Wert.
= (0110, 1001, 1100, 0111, 1100, 1000, 0101, 1010, 0011)
a) Prüffolgen im Taktabstand 1
Es sind die jeweils ersten 28 Glieder der Folgen
(u | i | ) | | , (u | i | ) | | , …, | (u | i | ) | | , (Z | i | ) | | , (Z | i | ) | | , |
1 | i ∈ N | 5 | i ∈ N | 33 | i ∈ N | 0 | i ∈ N | 1 | i ∈ N |
(Z | i | ) | | , (Z | i | ) | | , (u | i | ) | | , (s | i | ) | | , (s | i | ) | | , |
2 | i ∈ N | 3 | i ∈ N | 2 | i ∈ N | 1 | i ∈ N | 2 | i ∈ N |
(T | i | ) | | , (T | i | ) | | , …, | (T | i | ) | |
1 | i ∈ N | 2 | i ∈ N | 9 | i ∈ N |
dargestellt.
Takt | U(4 * I - 3) | Z | U(α) | S1 | S2 | T |
01: | 1 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 1 | 0 | 1 | 1 |
02: | 1 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 0 | 1 | 1 | 1 | 1 | 0 | 1 | 0 | 1 | 1 | 1 | 1 | 0 |
03: | 0 | 1 | 1 | 0 | 1 | 1 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
04: | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 |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 1 | 1 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 1 | 1 | 1 | 0 |
25: | 1 | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 1 | 0 | 1 | 1 | 0 | 1 | 1 | 1 | 0 | 1 | 0 |
26: | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 1 |
27: | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 1 | 1 | 1 | 0 | 1 | 1 |
28: | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 |
_ Fehler in der Kopie, Wert berechnet |
b) Prüffolgen im Taktabstand 127
Es sind die jeweils ersten 28 Glieder der Folgen
(u | 127i | ) | | , (u | 127i | ) | | , …, | (u | 127i | ) | | , (Z | 127i | ) | | , (Z | 127i | ) | | , |
1 | i ∈ N | 5 | i ∈ N | 33 | i ∈ N | 0 | i ∈ N | 1 | i ∈ N |
(Z | 127i | ) | | , (Z | 127i | ) | | , (u | 127i | ) | | , (s | 127i | ) | | , (s | 127i | ) | | , |
2 | i ∈ N | 3 | i ∈ N | 2 | i ∈ N | 1 | i ∈ N | 2 | i ∈ N |
(T | 127i | ) | | , (T | 127i | ) | | , …, | (T | 127i | ) | |
1 | i ∈ N | 2 | i ∈ N | 9 | i ∈ N |
dargestellt.
Takt | U(4 * I - 3) | Z | U(α) | S1 | S2 | T |
0127: | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 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| 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 |
2794: | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 1 | 1 | 0 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 |
2921: | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 1 | 1 | 0 | 1 | 1 | 1 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 1 | 0 | 1 | 0 |
3048: | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 1 | 1 | 0 | 1 | 1 | 1 | 1 | 0 | 0 |
3175: | 1 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 1 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 |
3302: | 1 | 1 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 1 | 1 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 1 | 0 | 0 |
3429: | 0 | 1 | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 1 | 1 | 1 | 1 | 0 | 1 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 |
3556: | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 |
_ Fehler in der Kopie, Wert berechnet |
c) Chiffrierung eines Prüftextes
Prüftext:
〈Bu〉〈CR〉〈LF〉ABC … XYZ〈Zi〉1234567890〈CR〉〈LF〉〈LF〉
〈 CR 〉 - Wagenrücklauf
〈 LF 〉 - Zeilenvorschub
〈 Bu 〉 - Buchstabenumschaltung, Register 1
〈 Zi 〉 - Ziffern-/Zeichenumschaltung, Register 2
〈 Ky 〉 - Kyrillischumschaltung, Register 3
〈 zwr 〉 - Leerzeichen
Folgende Werte werden pro Zeichen ausgegeben:
GT - Grundtext
CT - Chiffiertext
A1 - entspricht (a1-13i, a2+13i, …, a5+13i)
A2 - entspricht (a6+13i)
A3 - entspricht (a7+13i, a8+13i, …, a11+13i)
A4 - entspricht (a12+13i, a13+13i)
ZT - GT ⊕ A3 (bitweise Addition modulo 2)
Wobei: i = 0, …, 43
Alle Zahlen in der Tabelle sind Dezimalzahlen.
Der Grundtext wurde mittels ITA 2-Code umgesetzt.
(Die Kodierung erfolgt entgegengesetzt dem ITA-2)
(Bsp: ITA-2 "E" = 1, (8-bit) 0x10 = dezimal = 16)
(Die Gelb hinterlegten Spalten ist die MBF)
8bit Format | | ITA-2/CCITT-2 Format |
| Bu | WR | ZV | ZV | A | B | C | D | E | F | | | Bu | WR | ZV | ZV | A | B | C | D | E | F |
GT: | 31 | 02 | 08 | 08 | 24 | 19 | 14 | 18 | 16 | 22 | GT: | 31 | 08 | 02 | 02 | 03 | 25 | 14 | 09 | 01 | 13 |
A1: | 11 | 10 | 04 | 00 | 23 | 03 | 31 | 19 | 08 | 19 | A1: | 26 | 10 | 04 | 00 | 29 | 24 | 31 | 25 | 02 | 25 |
A2: | 01 | 00 | 01 | 01 | 01 | 00 | 00 | 01 | 01 | 01 | A2: | 01 | 00 | 01 | 01 | 01 | 00 | 00 | 01 | 01 | 01 |
A3: | 18 | 17 | 15 | 07 | 31 | 13 | 08 | 22 | 08 | 01 | A3: | 09 | 17 | 30 | 28 | 31 | 22 | 02 | 13 | 02 | 16 |
A4: | 02 | 02 | 01 | 01 | 03 | 03 | 02 | 02 | 01 | 01 | A4: | 01 | 01 | 02 | 02 | 03 | 03 | 01 | 01 | 02 | 02 |
ZT: | 13 | 19 | 07 | 15 | 07 | 30 | 06 | 04 | 24 | 23 | ZT: | 13 | 25 | 27 | 15 | 27 | 30 | 06 | 04 | 24 | 23 |
CT: | 31 | 29 | 01 | 15 | 13 | 06 | 06 | 16 | 02 | 06 | CT: | 31 | 23 | 16 | 30 | 22 | 12 | 12 | 01 | 08 | 12 |
| Bu | Q | T | V | P | N | N | E | WR | N | | Bu | Q | T | V | P | N | N | E | WR | N |
| |
| G | H | I | J | K | L | M | N | O | P | | G | H | I | J | K | L | M | N | O | P |
GT: | 11 | 05 | 12 | 26 | 30 | 09 | 07 | 06 | 03 | 13 | GT: | 26 | 20 | 06 | 11 | 15 | 18 | 27 | 12 | 24 | 22 |
A1: | 22 | 22 | 19 | 29 | 06 | 03 | 23 | 18 | 17 | 22 | A1: | 13 | 13 | 25 | 23 | 12 | 24 | 29 | 09 | 17 | 13 |
A2: | 01 | 01 | 00 | 01 | 00 | 00 | 00 | 01 | 01 | 00 | A2: | 01 | 01 | 00 | 01 | 00 | 00 | 00 | 01 | 01 | 00 |
A3: | 07 | 11 | 08 | 16 | 10 | 30 | 06 | 03 | 08 | 20 | A3: | 28 | 26 | 02 | 01 | 10 | 15 | 12 | 24 | 02 | 05 |
A4: | 03 | 02 | 01 | 03 | 02 | 01 | 01 | 00 | 02 | 03 | A4: | 03 | 01 | 02 | 03 | 01 | 02 | 02 | 00 | 01 | 03 |
ZT: | 12 | 14 | 04 | 10 | 20 | 23 | 01 | 05 | 11 | 25 | ZT: | 12 | 14 | 04 | 10 | 20 | 23 | 01 | 05 | 11 | 25 |
CT: | 04 | 17 | 16 | 22 | 09 | 10 | 25 | 10 | 19 | 09 | CT: | 04 | 17 | 01 | 13 | 18 | 10 | 19 | 10 | 25 | 18 |
| zwr | Z | E | F | L | R | W | R | B | L | | zwr | Z | E | F | L | R | W | R | B | L |
| |
| Q | R | S | T | U | V | W | X | Y | Z | | Q | R | S | T | U | V | W | X | Y | Z |
GT: | 29 | 10 | 20 | 01 | 28 | 15 | 25 | 23 | 21 | 17 | GT: | 23 | 10 | 05 | 16 | 07 | 30 | 19 | 29 | 21 | 17 |
A1: | 28 | 11 | 13 | 03 | 28 | 18 | 12 | 10 | 11 | 12 | A1: | 07 | 26 | 22 | 24 | 07 | 09 | 06 | 10 | 26 | 06 |
A2: | 00 | 00 | 01 | 00 | 01 | 00 | 00 | 00 | 01 | 00 | A2: | 00 | 00 | 01 | 00 | 01 | 00 | 00 | 00 | 01 | 00 |
A3: | 08 | 24 | 25 | 27 | 24 | 07 | 20 | 09 | 29 | 22 | A3: | 02 | 03 | 19 | 27 | 03 | 28 | 05 | 18 | 23 | 13 |
A4: | 02 | 00 | 00 | 01 | 02 | 03 | 00 | 01 | 03 | 03 | A4: | 01 | 00 | 00 | 02 | 01 | 03 | 00 | 01 | 03 | 03 |
ZT: | 21 | 18 | 13 | 26 | 04 | 08 | 13 | 30 | 08 | 07 | ZT: | 21 | 18 | 13 | 26 | 04 | 08 | 13 | 30 | 08 | 27 |
CT: | 20 | 20 | 10 | 16 | 18 | 13 | 28 | 20 | 23 | 11 | CT: | 05 | 05 | 10 | 01 | 09 | 22 | 07 | 05 | 29 | 26 |
| S | S | R | E | D | P | U | S | X | G | | S | S | R | E | D | P | U | S | X | G |
| |
| Zi | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | | Zi | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
GT: | 27 | 29 | 25 | 16 | 10 | 01 | 21 | 28 | 12 | 03 | GT: | 27 | 23 | 19 | 01 | 10 | 16 | 21 | 07 | 06 | 24 |
A1: | 31 | 27 | 27 | 14 | 14 | 28 | 03 | 10 | 26 | 20 | A1: | 31 | 27 | 27 | 14 | 14 | 07 | 24 | 10 | 11 | 05 |
A2: | 00 | 01 | 00 | 00 | 01 | 00 | 01 | 00 | 01 | 01 | A2: | 00 | 01 | 00 | 00 | 01 | 00 | 01 | 00 | 01 | 01 |
A3: | 20 | 04 | 20 | 09 | 08 | 00 | 23 | 22 | 06 | 00 | A3: | 05 | 04 | 05 | 18 | 02 | 00 | 29 | 13 | 12 | 00 |
A4: | 02 | 02 | 02 | 01 | 00 | 02 | 00 | 00 | 02 | 03 | A4: | 01 | 01 | 01 | 02 | 00 | 01 | 00 | 00 | 01 | 03 |
ZT: | 15 | 25 | 13 | 25 | 02 | 01 | 02 | 10 | 10 | 03 | ZT: | 15 | 25 | 13 | 25 | 02 | 01 | 02 | 10 | 10 | 03 |
CT: | 15 | 17 | 20 | 06 | 07 | 04 | 11 | 19 | 12 | 04 | CT: | 30 | 17 | 05 | 12 | 27 | 04 | 26 | 25 | 06 | 04 |
| V | Z | S | N | M | zwr | G | B | I | zwr | | V | Z | S | N | M | zwr | G | B | I | zwr |
| |
| 0 | WR | ZV | ZV | | | | | | | | 0 | WR | ZV | ZV | | | | | | |
GT: | 13 | 02 | 08 | 08 | | | | | | | GT: | 22 | 08 | 02 | 02 | | | | | | |
A1: | 15 | 16 | 22 | 13 | | | | | | | A1: | 30 | 01 | 13 | 22 | | | | | | |
A2: | 01 | 00 | 00 | 00 | | | | | | | A2: | 01 | 00 | 00 | 00 | | | | | | |
A3: | 30 | 29 | 17 | 24 | | | | | | | A3: | 15 | 23 | 17 | 03 | | | | | | |
A4: | 03 | 03 | 00 | 00 | | | | | | | A4: | 03 | 03 | 00 | 00 | | | | | | |
ZT: | 19 | 31 | 25 | 16 | | | | | | | ZT: | 19 | 31 | 25 | 16 | | | | | | |
CT: | 25 | 16 | 09 | 11 | | | | | | | CT: | 19 | 01 | 18 | 26 | | | | | | |
| W | E | L | G | | | | | | | | W | E | L | G | | | | | | |
Referat 21 Berlin, 19. Juli 1990
Das Dokument ist in 2 Exemplaren gefertigt.
Verteiler: 1. Ex. ZSI
2. Ex. ZCO/Referat 21
Quellen: Kryptologische Analyse T-310, GVS 402/80
Kryptologische Dokumentation zum LSZ 31, GVS 178/85
Beispielcode in C, Optimierungen wurden für die Verständlichkeit nicht realisiert.
Auf Windows, Linux und Microcontroller, unter allen Programmiersprachen, anwendbar.
Umsetzung auf Python als Datei auf der Freeware-Seite.
Abb.: GLCD Darstellung des BT/BTZ.
// Konstanten: U33(2), U5(6), U9(8), U21(14), U25(17), U29(23)
byte b_LZS[37] { 7, 4, 33, 30, 18, 36, 5, 35, 9, 16, 23, 26, 32, 12, 21, 1, 13, 25,
20, 8, 24, 15, 22, 29, 10, 28, 6, 0, 16, 4, 24, 12, 28, 32, 36, 20, 2 };
// Zugelassen; LZS-31, Langzeitschlüssel
unsigned long ul_synchronfolge = 0ul; // Synchronfolge
boolean s1_bit[120];
boolean s2_bit[120];
boolean bo_U_Vektor[37];
byte b_zeiger = 0;
// der U-Vektor ist die Startbedingung der 4bitigen Schieberegister, U[0] wird nicht genutzt!
boolean init_U_Vektor[37] {
false, false, true, true, false, true, false, false,
true, true, true, false, false, false, true, true,
true, true, true, false, false, true, false, false,
false, false, true, false, true, true, false, true,
false, false, false, true, true
};
unsigned long Zufall()
{
unsigned long ul_kg = 0; // variable Kenngruppe
while (ul_kg == 0ul)
{
ul_kg = random(); // die ersten 32 bit
ul_kg <<= 32;
unsigned long ul_kg2 = random();
ul_kg |= ul_kg2; // die letzten 32 bit
ul_kg &= 0x1fffffffffffffff; // Maskieren auf 61 Bit
}
return ul_kg;
}
void main()
{
if (Senden == true) Chiffrieren(Text);
else if (Empfangen == true) Dechiffrieren(Text);
}
void UVektorInit()
{
byte x = 0;
do
{
bo_U_Vektor[x] = init_U_Vektor[x];
x++;
} while (x < 37);
}
unsigned int KE()
{
byte b_fsBit = 0;
unsigned int ui_wurmBit = 0;
bool bo_Y_Vektor[9]; // Ergebnis und U-Vektoren, Beachtung zeitlicher Abläufe
bool bo_Z[4]; // Z0 … Z3 (Z1 bis Z4)
/* 5 bit sammeln aus 127ten runde * bit des Fs Zeichen,
127 - 254 - 381 - 508 - 635 - 762 - 889 - 1016 - 1143 - 1270 - 1397 - 1524 - 1651,
neues FsZeichen mit: 1778, n + 127 … */
do // Achtung 13 Runden, Bit 0, 6, 12 und 13 sind ungenutzt
{
for (byte b_runde = 0; b_runde < 127; ++b_runde)
{
boolean bo_tempS1 = s1_bit[b_zeiger]; // S1 in T92 - Y1
boolean bo_tempS2 = s2_bit[b_zeiger]; // S2 in Z0, T61 - Y13
//Beachtung des zeitlichen Ablaufes der elektronischen Schaltung!
// Konstanten: U33(2), U5(6), U9(8), U21(14), U25(17), U29(23)
// T-Funktion mit LZS xx - entsprechend Auswahl; b_LZS[] die P'' Werte
bo_Z[0] = Z(bo_tempS2, bo_U_Vektor[b_LZS[0]], bo_U_Vektor[b_LZS[1]], bo_U_Vektor[33], bo_U_Vektor[b_LZS[3]], bo_U_Vektor[b_LZS[4]]);
bo_Z[1] = Z(bo_U_Vektor[5], bo_U_Vektor[b_LZS[7]], bo_U_Vektor[9], bo_U_Vektor[b_LZS[9]], bo_U_Vektor[b_LZS[10]], bo_U_Vektor[b_LZS[11]]);
bo_Z[2] = Z(bo_U_Vektor[b_LZS[13]], bo_U_Vektor[21], bo_U_Vektor[b_LZS[15]], bo_U_Vektor[b_LZS[16]], bo_U_Vektor[25], bo_U_Vektor[b_LZS[18]]);
bo_Z[3] = Z(bo_U_Vektor[b_LZS[20]], bo_U_Vektor[b_LZS[21]], bo_U_Vektor[b_LZS[22]], bo_U_Vektor[29], bo_U_Vektor[b_LZS[24]], bo_U_Vektor[b_LZS[25]]);
ul_synchronfolge = Rot_Ffolge(ul_synchronfolge); // rotiere F-Folge die Synchronfolge einmal
bool bo_T = (ul_synchronfolge & 0x1000000000000000ul) != 0;
// Y = Werte entsprechend LZS-31 D xor f xor Z xor P''
bo_Y_Vektor[0] = bo_U_Vektor[b_LZS[35]] ^ bo_T; // Y33 = U20 xor f
bo_T ^= bo_Z[0];
bo_Y_Vektor[1] = bo_U_Vektor[b_LZS[34]] ^ bo_T; // Y29 = U36 xor f xor Z0
bo_T ^= bo_U_Vektor[b_LZS[5]]; // U36 entsprechend P''
bo_Y_Vektor[2] = bo_U_Vektor[b_LZS[33]] ^ bo_T; // Y25 = U32 xor f xor Z0 xor U36
bo_T ^= bo_Z[1];
bo_Y_Vektor[3] = bo_U_Vektor[b_LZS[32]] ^ bo_T; // Y21 = U28 xor f xor Z0 xor U36 xor Z1
bo_T ^= bo_U_Vektor[b_LZS[12]]; // U12 entsprechend P''
bo_Y_Vektor[4] = bo_U_Vektor[b_LZS[31]] ^ bo_T; // Y17 = U12 xor f xor Z0 xor U36 xor Z1 xor U32
bo_T ^= bo_tempS2 ^ bo_Z[2];
bo_Y_Vektor[5] = bo_U_Vektor[b_LZS[30]] ^ bo_T; // Y13 = U24 xor f xor Z0 xor U36 xor Z1 xor U32 xor S2 xor Z2
bo_T ^= bo_U_Vektor[b_LZS[19]]; // U8 entsprechend P''
bo_Y_Vektor[6] = bo_U_Vektor[b_LZS[29]] ^ bo_T; // Y9 = U4 xor f xor Z0 xor U36 xor Z1 xor U32 xor S2 xor Z2 xor U8
bo_T ^= bo_Z[3];
bo_Y_Vektor[7] = bo_U_Vektor[b_LZS[28]] ^ bo_T; // Y5 = U16 xor f xor Z0 xor U36 xor Z1 xor U32 xor S2 xor Z2 xor U8 xor Z3
bo_T ^= bo_U_Vektor[b_LZS[26]]; // U6 entsprechend P''
bo_Y_Vektor[8] = bo_tempS1 ^ bo_T; // Y1 = S1 xor f xor Z0 xor U36 xor Z1 xor U32 xor S2 xor Z2 xor U8 xor Z3 xor U6
bo_U_Vektor[36] = bo_U_Vektor[35]; // U-Vektoren schieben
bo_U_Vektor[35] = bo_U_Vektor[34];
bo_U_Vektor[34] = bo_U_Vektor[33];
bo_U_Vektor[33] = bo_Y_Vektor[0]; // Y33
bo_U_Vektor[32] = bo_U_Vektor[31];
bo_U_Vektor[31] = bo_U_Vektor[30];
bo_U_Vektor[30] = bo_U_Vektor[29];
bo_U_Vektor[29] = bo_Y_Vektor[1]; // Y29;
bo_U_Vektor[28] = bo_U_Vektor[27];
bo_U_Vektor[27] = bo_U_Vektor[26];
bo_U_Vektor[26] = bo_U_Vektor[25];
bo_U_Vektor[25] = bo_Y_Vektor[2]; // Y25;
bo_U_Vektor[24] = bo_U_Vektor[23];
bo_U_Vektor[23] = bo_U_Vektor[22];
bo_U_Vektor[22] = bo_U_Vektor[21];
bo_U_Vektor[21] = bo_Y_Vektor[3]; // Y21;
bo_U_Vektor[20] = bo_U_Vektor[19];
bo_U_Vektor[19] = bo_U_Vektor[18];
bo_U_Vektor[18] = bo_U_Vektor[17];
bo_U_Vektor[17] = bo_Y_Vektor[4]; // Y17;
bo_U_Vektor[16] = bo_U_Vektor[15];
bo_U_Vektor[15] = bo_U_Vektor[14];
bo_U_Vektor[14] = bo_U_Vektor[13];
bo_U_Vektor[13] = bo_Y_Vektor[5]; // Y13;
bo_U_Vektor[12] = bo_U_Vektor[11];
bo_U_Vektor[11] = bo_U_Vektor[10];
bo_U_Vektor[10] = bo_U_Vektor[9];
bo_U_Vektor[9] = bo_Y_Vektor[6]; // Y9;
bo_U_Vektor[8] = bo_U_Vektor[7];
bo_U_Vektor[7] = bo_U_Vektor[6];
bo_U_Vektor[6] = bo_U_Vektor[5];
bo_U_Vektor[5] = bo_Y_Vektor[7]; // Y5;
bo_U_Vektor[4] = bo_U_Vektor[3];
bo_U_Vektor[3] = bo_U_Vektor[2];
bo_U_Vektor[2] = bo_U_Vektor[1];
bo_U_Vektor[1] = bo_Y_Vektor[8]; // Y1;
++b_zeiger; // Zeiger auf nächstes Bit
if (b_zeiger > 119) b_zeiger = 0; // Zeiger entspricht das rotieren des Schlüssels S1, S2
} // for, 127 Runden!
if (bo_U_Vektor[b_LZS[36]] == true) // Reihenfolge in der PC-Darstellung reverse!
{
if (b_fsBit < 5)
{
ui_wurmBit |= (unsigned int)(0x1 << b_fsBit);
}
if ((b_fsBit > 5) & (b_fsBit < 11))
{
ui_wurmBit |= (unsigned int)(0x1 << b_fsBit);
}
}
++b_fsBit; // nächstes bit
} while (b_fsBit < 13); // while 13 Runden
ui_wurmBit &= 0x7df; // Maskieren bit 0 bis 4, bit 6 bis 10
return ui_wurmBit; // Rückgabe 11 bit Wurm
}
byte Chiffrieren(byte b_klartext)
{
unsigned int ui_key = KE();
// Schritt 1 … 5, Schieberegister aufbauen
byte b_SRV3 = 0x1f; // Runden bis 0x1f in SRV2
byte b_SRV2 = (byte)(ui_key & 0x1f); // bit 0 … bit 4 == 1-5 des Schlüssels, Schritt 1 … 5, Schritt 6, Symetriewert bilden, rekursion
while ((b_SRV2 < 0x1f) & (b_SRV2 > 0))
{ // wenn 11111, 0x1f ODER 0 abbrechen
b_SRV2 = Rekursion(b_SRV2);
b_SRV3 = Rekursion(b_SRV3);
}
// Schritt 6 ***************************** Bit 6 bleibt ungenutzt!, Schritt 7 … 11
b_SRV2 = b_SRV3; // b_SRV3 nach b_SRV2 kopieren
b_SRV3 = (byte)(b_klartext ^ ((ui_key & 0x07c0) >> 6)); // Additionsreihe bit 6 bis 10 (7 … 11) XOR Ktxt (5bit), Schritt 7 … 11
while ((b_SRV2 < 0x1f) & (b_SRV2 > 0)) // bit 0 bis 4 (1-5)
{ // wenn 11111 ( 0x1f oder 31 ) ODER 0 abbrechen
b_SRV2 = Rekursion(b_SRV2);
b_SRV3 = Rekursion(b_SRV3);
}
// Schritt 13, neues Zeichen holen und neue Schlüssel und beginn bei Schritt 1
return b_SRV3; // Ausgabe Chiffriertext
}
byte Dechiffrieren(byte b_crypt)
{
unsigned int ui_key = KE();
byte b_SRV3 = b_crypt;
byte b_SRV2 = (byte)(ui_key & 0x1f); // bit 0 bis 4 (1-5)
while ((b_SRV2 < 0x1f) & (b_SRV2 > 0))
{ // Rekursion der Additionsreihe in SRV2 und des GTX in SRV3
b_SRV2 = Rekursion(b_SRV2);
b_SRV3 = Rekursion(b_SRV3); // Z gebildet
}
b_SRV3 ^= (byte)((ui_key & 0x07c0) >> 6); // XOR Additionsreihe bit 6 bis 11 (7 … 11) mit dem Zwischentext Z
return b_SRV3;
}
bool Z(bool b_1,bool b_2,bool b_3,bool b_4,bool b_5,bool b_6)
{
bool bo_temp =true ^ b_1 ^ b_5 ^ b_6 ^ (b_1 && b_4);
bo_temp ^= (b_2 && b_3) ^ (b_2 && b_5) ^ (b_4 && b_5) ^ (b_5 && b_6);
bo_temp ^= (b_1 && b_3 && b_4) ^ (b_1 && b_3 && b_6) ^ (b_1 && b_4 && b_5);
bo_temp ^= (b_2 && b_3 && b_6) ^ (b_2 && b_4 && b_6) ^ (b_3 && b_5 && b_6);
bo_temp ^= (b_1 && b_2 && b_3 && b_4) ^ (b_1 && b_2 && b_3 && b_5);
bo_temp ^= (b_1 && b_2 && b_5 && b_6) ^ (b_2 && b_3 && b_4 && b_6);
bo_temp ^= (b_1 && b_2 && b_3 && b_4 && b_5) ^ (b_1 && b_3 && b_4 && b_5 && b_6);
return (bo_temp);
}
static byte Rekursion(byte b_Register)
{
const byte b_Bit0 = 0x01;
const byte b_Bit3 = 0x04;
const byte b_5Bitmaske = 0x1f; // Bitmaske aller werte innerhalb von 0 … 31
byte b_ret = b_Register; // übergabe der Eingabe an das Ausgabebyte
bool bo_xor = ((b_Bit0 & b_ret) != 0) ^ ((b_Bit3 & b_ret) != 0);
b_ret >>= 1; // bo_XOR bildet rekusrionsbit aus Bit 5 und Bit 3
b_ret |= (byte)(bo_xor == true ? 0x10 : 0);
b_ret &= b_5Bitmaske;
return b_ret;
}
unsigned long Synchronfolge(unsigned long ul_Para, byte b_Runden)
{
for (byte b_i = 0; b_i < b_Runden; ++b_i)
{ // Umformung durch Bit 0 xor 1 xor 2 xor 5
ul_Para = Rot_Ffolge(ul_Para);
}
return ul_Para;
}
/* rotiere f-Folge */
unsigned long Rot_Ffolge(unsigned long ul_Paramter)
{
bool bo_m2; // ergebnis des XOR bit 0,1,2,5
bo_m2 = ((ul_Paramter & 0x1ul) != 0ul) ^ ((ul_Paramter & 0x2ul) != 0ul) ^ ((ul_Paramter & 0x4ul) != 0ul) ^ ((ul_Paramter & 0x20ul) != 0ul); // Umformung durch Bit 0 xor 1 xor 2 xor 5
ul_Paramter >>= 1; // Shift 1, von 60 nach 0
if (bo_m2 == true)
{
ul_Paramter |= 0x1000000000000000ul; // bit 61
}
return ul_Paramter;
}