From f6897d446bd01143b53abb057713401380e30767 Mon Sep 17 00:00:00 2001 From: sa Date: Mon, 28 Mar 2022 13:57:55 -0400 Subject: [PATCH] added encryption algorithm --- src/encrypt.lua | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) 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)