formatted code better
This commit is contained in:
parent
07e348129b
commit
4b5ed39b91
@ -4,15 +4,6 @@ implementation of the RC5 cipher in Lua5.1
|
|||||||
03/11/2022
|
03/11/2022
|
||||||
Sean Smith
|
Sean Smith
|
||||||
sean@spacealien.xyz
|
sean@spacealien.xyz
|
||||||
|
|
||||||
w=word size in bits
|
|
||||||
r=number of rounds
|
|
||||||
b=key size in bytes
|
|
||||||
K=secret key
|
|
||||||
u=w/8 (the length of a word in bytes)
|
|
||||||
K[] is the key as an array of bytes
|
|
||||||
c=length of key in words
|
|
||||||
|
|
||||||
]]
|
]]
|
||||||
|
|
||||||
local inspect = require 'inspect'
|
local inspect = require 'inspect'
|
||||||
@ -39,12 +30,6 @@ L = K
|
|||||||
local P = 0xb7e151628aed2a6b
|
local P = 0xb7e151628aed2a6b
|
||||||
local Q = 0x9e3779b97f4a7c15
|
local Q = 0x9e3779b97f4a7c15
|
||||||
|
|
||||||
--[[
|
|
||||||
print(inspect(K))
|
|
||||||
print("LLLLLL")
|
|
||||||
print(inspect(L))
|
|
||||||
]]
|
|
||||||
|
|
||||||
local S = {}
|
local S = {}
|
||||||
S[0] = P --initialize the S array
|
S[0] = P --initialize the S array
|
||||||
for i = 1, t do
|
for i = 1, t do
|
||||||
@ -85,8 +70,8 @@ for f = 1, 3 * math.max(t,c) do
|
|||||||
end
|
end
|
||||||
|
|
||||||
--8 bytes to be encrypted
|
--8 bytes to be encrypted
|
||||||
A = 00000000
|
A = 12345678
|
||||||
B = 00000000
|
B = 12345678
|
||||||
print("Plaintext A & B")
|
print("Plaintext A & B")
|
||||||
print(A)
|
print(A)
|
||||||
print(B)
|
print(B)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user