diff --git a/src/encrypt.lua b/src/encrypt.lua index 8edec32..0e35b43 100644 --- a/src/encrypt.lua +++ b/src/encrypt.lua @@ -85,4 +85,17 @@ for f = 1, 3 * math.max(t,c) do ]] end - +--encrypt +--assume that the input block is given in two w-bit registers +--A and B +--the A and B found in the setup have been loaded into the S +--array and can now be filled with words of plaintext +A = A + S[1] +B = B + S[2] +for i = 1, r do + A = bit.rol((bit.bxor(A, B)), B) + S[2*i] + B = bit.rol((bit.bxor(B, A)), A) + S[2*i + 1] +end +print("Encrypted output A & B") +print(A) +print(B)