Algoritmul FEAL
Algoritmul FEAL
Algoritmul FEAL
1 Introduction
FEAL has three options: key length, round number and key parity. The key
length selects either 64-bit key or 128-bit key, the round number (N)
specifies the internal iteration number for data randomization, and the key
parity option selects either the use or non-use of parity bits in a key block.
One subset of FEAL, called FEAL-NX, is N round FEAL using a 128-bit key
without key parity.
Determines the round number (N) for FEAL data randomization, where N ≥
32 and even.
1.3.1 Definitions
1
(2) key: Key information used for enciphering/deciphering.
(3) round number (N): the internal iteration number for FEAL data
randomization.
(4) extended key: 16-bit blocks, Ki, which are a randomized and extended
form of the key, are output from FEAL key schedule, where i=0, 1, ..., (N+7).
(1) A, Ar,... : blocks (The lengths of blocks are defined in each section)
(2) (A, B,...) : concatenation in this order
(3) A ⊕ B: exclusive-or operation of A and B
(4) φ : zero block, 32-bits long
(5) = : Transfer from right side to left side
(6) Bit position: 1, 2, 3,.... count from the first left side bit (MSB) in a block
towards the right.
2 Enciphering algorithm
2.2 Pre-processing
2
First,
(L0, R0 ) = (L0, R0 ) ⊕ (KN, KN+1, KN+2, KN+3 )
Next,
(L0, R0 )= (L0, R0 ) ⊕ ( φ , L0 )
Input (L0, R0), and calculate the equations below for r from 1 to N
iteratively,
Rr = Lr-1 ⊕ f (Rr-1, Kr-1)
Lr = Rr-1
2.4 Post-processing
Interchange the final output of the iterative calculation, (LN, RN), into (RN,
LN).
Next calculate:
(RN , LN)= (RN , LN) ⊕ ( φ , RN)
Lastly,
(RN , LN)= (RN, LN) ⊕ (KN+4, KN+5, KN+6, KN+7)
3 Deciphering algorithm
3
key schedule described in clause 4. Similarly, function f used here is defined
in clause 5. The computation stages, specified more fully in subclauses 3.2 to
3.4, shall be as follows (see also Fig. 1):
a) Pre-processing (see 3.2)
b) Iterative calculation (see 3.3)
c) Post-processing (see 3.4)
3.2 Pre-processing
First,
(RN , LN)= (RN, LN) ⊕ (KN+4, KN+5, KN+6, KN+7)
Next,
(RN , LN)= (RN, LN) ⊕ ( φ , RN)
Input (RN , LN), and calculate the equations below for r from N to 1
iteratively,
Lr-1 = Rr ⊕ f (Lr, Kr-1)
Rr-1 = Lr
3.4 Post-processing
Change the final output of the iterative calculation, (R0, L0), into (L0, R0).
Next calculate:
(L0 , R0)= (L0, R0) ⊕ ( φ , L0)
Lastly,
4
(L0, R0)= (L0, R0) ⊕ (KN, KN+1, KN+2, KN+3)
4 Key schedule
First , the key schedule of FEAL-NX is described (see also Fig. 2), where the
functions used here are defined in Clause 5. The key schedule yields the
extended key Ki (i=0, 1, 2, 3..., N+7) from the 128-bit key.
Input 128-bit key is equally divided into a 64-bit left key, KL, and a 64-bit
right key, KR. (KL, KR) is the inputted 128-bit key.
5
Dr = Ar-1
Ar = Br-1
Br = fK(α, β)
= fK (Ar-1, (Br-1 ⊕ Dr-1) ⊕ Qr))
K2(r-1) = (Br0, Br1)
K2(r-1)+1 = (Br2, Br3)
Ar, Br, Dr and Qr are auxiliary variables, where (Br0, Br1, Br2, Br3) = Br , Brj
(j=0 to 3) 8-bits long, and r = 1 to (N/2)+4.
5 Functions
f (α, β) is shortened to f. α and β are divided as follows (αi and βi are 8-bits
long).
Functions S0 and S1 are defined in clause 5.3.
6
Example in hex:
Inputs: α = 00 FF FF 00, β = FF FF , Output: f = 10 04 10 44
fK(α, β) is shortened to fK, and α are divided as follows (αi and βi are 8-bits
long).
Functions S0 and S1 are defined in clause 5.3.
5.3 Function S
where X1 and X2 are 8-bit blocks and Rot2(T) is the result of a 2-bit left
rotation operation on 8-bit block, T.
7
Example:
Given X1 = 00010011, X2 = 11110010 then
T = (X1 + X2 + 1) mod 256= 00000110
S1 (X1, X2 )= Rot2(T) = 00011000
8
6.3 The key schedule (see clause 4)
Consider first the generation of the extended keys, K0, K1, K2, … , K39 , each
consisting of 16 bits generated from the key-block K.
Let A0 be the left half of KL and let B0 be the right half of KL, i.e.,
( A0 , B0 ) = KL and D0 = φ . Thus:
A0 = 0000 0001 0010 0011 0100 0101 0110 0111
in bit sequence
= 01 23 45 67 in hex
B0 = 1000 1001 1010 1011 1100 1101 1110 1111
in bit sequence
= 89 AB CD EF in hex
D0 = 0000 0000 0000 0000 0000 0000 0000 0000
in bit sequence
= 00 00 00 00 in hex
9
A1 = B0 = 1000 1001 1010 1011 1100 1101 1110 1111
in bit sequence
= 89 AB CD EF in hex
B1 = fK (A0, B0 ⊕ D0 ⊕ Q1)
= 0111 0101 0001 1001 0111 0001 1111 1001
in bit sequence
= 75 19 71 F9 in hex
K0 = 0111 0101 0001 1001 in bit sequence
= 75 19 in hex
K1 = 0111 0001 1111 1001 in bit sequence
= 71 F9 in hex
10
6.4.1 Pre-processing (see 2.2)
Next,
(L0, R0) = (L0, R0) ⊕ ( φ , L0)
= 0001 1001 0110 1010 1001 1010 1011 0001
1111 1001 0111 1111 0001 1011 0010 0001
in bit sequence
= 19 6A 9A B1 F9 7F 1B 21 in hex
11
.
6.4.2.1 Calculation of R0 and L0 at the first stage
β = (β0, β1 ) = K0
= 0111 0101 0001 1001 in bit sequence
12
= 75 19 in hex
13
6.4.2.3 Continued calculations
If the above calculations are continued it will be found that Li and Ri etc. are
as given in hex. (only i in decimal)
1 F9 7F 1B 21 4C 36 67 CD 75 19 55 5C FD 7C
2 4C 36 67 CD DE 02 58 65 71 F9 27 7D 43 44
3 DE 02 58 65 06 82 45 EF 84 E9 4A B4 22 22
4 06 82 45 EF 69 E5 14 95 48 86 B7 E7 4C F0
5 69 E5 14 95 3E 27 61 05 88 E5 38 A5 24 EA
6 3E 27 61 05 DA 4B 20 7D 52 3B B3 AE 34 E8
7 DA 4B 20 7D 3B 40 E0 FA 4E A4 05 67 81 FF
8 3B 40 E0 FA 83 50 5F 94 7A DE 59 1B 7F E9
9 83 50 5F 94 9E A6 25 93 FE 40 A5 E6 C5 69
10 9E A6 25 93 6B CC 2E 80 5E 76 E8 9C 71 14
11 6B CC 2E 80 B7 79 7F FC 98 19 29 DF 5A 6F
12 B7 79 7F FC 88 8D EF 7A EE AC E3 41 C1 FA
13 88 8D EF 7A 93 F8 74 E6 1B D4 24 81 0B 1A
14 93 F8 74 E6 37 D1 63 B7 24 55 BF 5C 8C CD
15 37 D1 63 B7 44 46 BC E4 DC A0 D7 BE C8 02
16 44 46 BC E4 FA FE 29 0B 65 3B CD 2F 4A BC
17 FA FE 29 0B D8 6B 48 E4 3E 32 9C 2D F4 00
18 D8 6B 48 E4 54 2D 6E BB 46 52 AE D3 47 B0
19 54 2D 6E BB 2C 82 BF 2A 1C C1 F4 E9 F7 CE
20 2C 82 BF 2A 5B BA E9 71 34 DF 0F 97 87 CA
21 5B BA E9 71 38 28 49 8B 77 8B 14 AA F6 A1
22 38 28 49 8B 0E A7 1A 8C 77 1D 55 1D F3 FD
14
23 0E A7 1A 8C 33 9C D0 13 D3 24 0B B4 99 98
24 33 9C D0 13 C6 58 51 F1 84 10 C8 FF 4B 7D
25 C6 58 51 F1 E0 B2 08 38 1C A8 D3 2E D8 2B
26 E0 B2 08 38 71 55 D4 0B BC 64 D7 0D 85 FA
27 71 55 D4 0B BE 94 A0 EA A0 DB 5E 26 A8 D2
28 BE 94 A0 EA 88 95 B5 3A BD D2 F9 C0 61 31
29 88 95 B5 3A E1 DB DC 34 1F 5F 5F 4F 7C DE
30 E1 DB DC 34 A6 3F CF 84 8F 1C 2E AA 7A BE
31 A6 3F CF 84 93 2D DF 16 6B 81 72 F6 03 22
32 93 2D DF 16 03 E9 32 D4 B5 60 A5 D6 FD 50
----------------------------------------------------------------------------------------------------------
Next,
(R32, L32 ) = (R32, L32 ) ⊕ ( φ , R32)
(R32, L32 ) = 0000 0011 1110 1001 0011 0010 1101
0100
1001 0000 1100 0100 1110 1101 1100
0010
in bit sequence
= 03 E9 32 D4 90 C4 ED C2 in hex.
15
Lastly,
(R32, L32 ) = (R32, L32 ) ⊕ (K36, K37, K38, K39 )
= 1001 1100 1001 1011 0101 0100 1001
0111
0011 1101 1111 0110 1000 0101 1111
1000
in bit sequence
= 9C 9B 54 97 3D F6 85 F8 in hex.
16
Plaintext {Ciphertext block }
(64 bits)
(64 bits)
⊕ (KN , KN+1, KN+2 , KN+3)
{(KN+4, KN+5 , KN+6, KN+7 )}
L 0{RN} ⊕ R0{L N}
K0{KN-1}
L 0{RN }
⊕ f R0{LN}
K 1{KN-2}
L1{RN-1}
⊕ f R1{LN-1}
K2{K N-3}
L2{RN-2}
⊕ f R2{LN-2}
KN-1{K 0}
L N-1{R1}
⊕ f RN-1{L1}
RN{L 0} ⊕ L N{R0}
17
Key block (KL,KR) : 128bits
KL KR
32 bits
A0 B0
⊕
Q1
fK ⊕ 32 bits
32 bits
(K0,K1)
D1
A1 B1
Q2
fK ⊕ ⊕
(K2,K3)
A2 B2
D2
Q3
fK ⊕ ⊕
(K4,K5)
QN/2+4
fK ⊕ ⊕
(32 bits) KR1 ⊕ KR2 KR1 KR2
(KN+6,KN+7)
Qr=KR1 ⊕ KR2 r = 1,4,7,…
K2(r-1) : Left half of Br (16bits) Qr=KR1 r = 2,5,8,…
K2(r-1)+1 : Right half of Br (16bits) Qr=KR2 r = 3,6,9,…
Number of iterations is (N/2)+4. KR=(KR1,KR2)
18
β(16 bits)
β0 β1
S0
α0
S
S11
⊕ ⊕
f ( α,β) α1
α
(32 bits) (32 bits)
S0 ⊕ ⊕
α2 αi, βi : 8 bits
X2
Y S1
X1 α3
19
α(32 bits)
α0 α1 α2 α3
⊕ ⊕ β0
S1 ⊕
β1
β
⊕ S0
β2 (32 bits)
β3
S0 ⊕ ⊕ S1
αi,βi : 8 bits
(32 bits)
fK (α, β)
20