Cipher Chaining
ECB(electronic codebook) mode
- Same plain text produce the same cipher text
- No error propagation
- Residue is NO_HANDLE
plain text –CW encrypt–> cipher text
cipher text –CW decrypt–> plain text
CBC(cipher block chaining) mode
- Same plain text produce the different cipher text
- Error propagation to next block
- Need initialization vector
if A ^ B = C
then C ^ A = B, C ^ B = A
p(n) xor iv/p(n-1) –CW encrypt–> c(n)
c(n) –CW decrypt–> xor iv/c(n-1) –> p(n)
Residue mode
ANSI(American National Standard Institute) SCTE(Society of Cable Telecommunications Engineers) 52
c(n-1) –>CW encrypt–> c’(n) –> xor short p(n) –> short c(n)
c(n-1) –>CW encrypt–> c’(n) –> xor short c(n) –> short p(n)
CTS(cipher text stealing)
encrypt:
Remain = sizeof(short p(n))
p’(n) = short p(n) + 0[Remain, Block_Len]
c(n) = c(x)[1, Remain]
p(n-1) xor c(n-2) –CW encrypt–> c(x) –> c(n)
p(n) –> p’(n) –> xor c(x) –> p(x) –CW encrypt–> c(n-1)
decrypt:
c(x) = short c(n) + p(x)[Remain+1, Block_Len]
p(n) = p’(n)[1, Remain]
c(n-1) –CW decrypt–> p(x) –> xor c(x) –> p’(n) –> short p(n)
c(x) –CW decrypt–> xor c(n-2) –> p(n-1)
CFB(cipher feedback) mode
- Same plain text produce the different cipher text.
- Need iv.
- Error propagation to next block.
- Residue is NO_HANDLE.
iv/c’(n-1) –CW encrypt–> c’(n) –> xor p(n) –> c(n)
iv/c’(n-1) –CW encrypt–> c’(n) –> xor c(n) –> p(n)
OFB(output feedback) mode
- Same plain text produce the different cipher text.
- Need iv.
- No error propagation.
- Residue is NO_HANDLE.
- One error bit of cipher text only cause one error bit of plain text.
iv/c’(n-1) –CW encrypt–> c’(n) –> xor p(n) –> c(n)
iv/c’(n-1) –CW encrypt–> c’(n) –> xor c(n) –> p(n)
CTR(counter) mode
- Same plain text produce the different cipher text.
- Need initialization counter.
- No error propagation.
- Residue is NO_HANDLE, but it’s cipher text.
- One error bit of cipher text only cause one error bit of plain text.
iv(n-1) – counter –> iv(n)
iv(n) –CW encrypt–> xor p(n) –> c(n)
iv(n) –CW encrypt–> xor c(n) –> p(n)
Reference:
https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation