added encryption algorithm
This commit is contained in:
parent
3773e9b22f
commit
f6897d446b
@ -85,4 +85,17 @@ for f = 1, 3 * math.max(t,c) do
|
|||||||
]]
|
]]
|
||||||
end
|
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)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user