Cryptography Reference
In-Depth Information
Algorithm 4.3. CBC encryption
.
Input
:An
l
-block message
m
=
m
1
...
m
l
, and a block cipher key
k
.
Output
: The ciphertext
Enc
(
k
,
m
)
=
c
1
...
c
l
.
Initialization
:
IV
n
, chosen at random.
←{
0
,
1
}
Encryption
:
c
0
IV
;
for
i
from
1to
l
do
c
i
:=
:=
F
k
(
m
i
⊕
c
i
−
1
)
end do
;
return
c
1
...
c
l
.
Decryption is similar:
Algorithm 4.4. CBC decryption
.
Input
: An IV, a ciphertext
c
=
c
1
...
c
l
, and a block cipher key
k
.
Output
: The plaintext
Dec
(
k
,
c
)
=
m
1
...
m
l
.
Decryption
:
c
0
:=
IV
;
for
i
from
1to
l
do
m
i
:=
D
k
(
c
i
)
⊕
c
i
−
1
end do
;
return
m
1
...
m
l
.