|
2001-02-19
Steak -
Encryption Algorithm
A specification of the inverse of the decryption
algorithm is available here.
Notation:
[<index>] denotes index of a vector. A reference to a vector without index is a typecast to an integer variable.
[<row>,<col>] denotes index of a two dimensional matrix.
xor denotes bitwise xor.
rol denotes bitwise rotation left.
** denotes "to the power of".
+ denotes addition modulo 2**32
/ denotes integer division
:= denotes assignment
DWORD a 4-vector of bytes.
INPUT:
One byte of plain text Pk, a 4x256-matrix D of DWORDs, an n-vector A of DWORDs, an n-vector Vk of DWORDs.
OUTPUT:
One byte of cipher text Ck, an n-vector Vk+1 of DWORDs.
VARIABLES:
An integer I, a DWORD B, a DWORD PV, a DWORD E, a byte F, an n-vector V of DWORDS.
(1) PV := Vk[1]
(2) For I := n downto 2 do
--- Main function:
(2.1) B := A[I] +
PV
(2.2) E := D[0,B[0]] xor
D[1,B[1]] xor D[2,B[2]] xor D[3,B[3]]
(2.3) PV := (E +
Vk[I]) rol 4
(2.4) V[I] := PV
--- End of Main function
--- Main function, last round, returns F, no rol:
(3) B := A[1] + PV
(4) E := D[0,B[0]] xor D[1,B[1]] xor
D[2,B[2]] xor D[3,B[3]]
(5) F := E[0]
(6) V[1] := E + Vk[1]
--- End of Main function last round
--- Feedback process:
(7) Ck := Pk xor
F
(8) Vk+1 := V/256
(9) Vk+1[n][3] :=
Ck
--- End of Feedback process
|