Cryptography Reference
In-Depth Information
Listing 4-8
The FEAL round function,
f
.
##########################################
#
Feal round function, f
##########################################
def
f(alpha, beta):
#
Split alpha and beta
a = demux(alpha)
b = demux(beta)
#
Make the output four 8-bit values
fs = [0,0,0,0]
#
Calculate each 8-bit value
fs[1] = a[1] ^ b[0] ^ a[0]
fs[2] = a[2] ^ b[1] ^ a[3]
fs[1] = sbox(fs[1], fs[2], 1)
fs[2] = sbox(fs[2], fs[1], 0)
fs[0] = sbox(a[0], fs[1], 0)
fs[3] = sbox(a[3], fs[2], 1)
# Return the 32-bit result
return
mux(fs)
4.7.4 Key Scheduling
The key scheduling algorithm for FEAL is meant to split up a 64-bit key into various derived subparts (based
on the
f
K
key scheduling function), for use in the main round function of FEAL.
1. Let
K
= (
A
0
,
B
0
) and
D
0
= 0.
2. For eight rounds,
r
= 1, ... , 8:
(a)
D
r
=
A
r
-1
.
(b)
A
r
=
B
r
-1
.
(c)
B
r
=
f
K
(
A
r
-1
,
B
r
-1
⊕
D
r
-1
).
(d)
(e)
In Python, we can implement this fairly easily, as shown in
Listing 4-9
.
Search WWH ::
Custom Search