found c
This commit is contained in:
parent
c712308aa5
commit
9f1d3d4b17
34
encrypt.lua
34
encrypt.lua
@ -5,11 +5,35 @@ implementation of the RC5 cipher in Lua
|
||||
Sean Smith
|
||||
sean@spacealien.xyz
|
||||
|
||||
-initialize the variables specified in the paper
|
||||
-translate and copy the functions in the appendix of the paper
|
||||
--were gonna use static variables of 32bit key for now
|
||||
-do key expansion
|
||||
|
||||
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 insert
|
||||
local concat
|
||||
local tostring
|
||||
local modf
|
||||
|
||||
local w=64
|
||||
local r=24
|
||||
local b=16
|
||||
local K="globglogabgalab1"
|
||||
local u=8
|
||||
--local c=2 (with globglogabgalab1 as the key c should =2)
|
||||
|
||||
--magic constants for 64bit word size (hex)
|
||||
local P = 0xb7e151628aed2a6b
|
||||
local Q = 0x9e3779b97f4a7c15
|
||||
|
||||
--break K into words
|
||||
--u = w / 8
|
||||
c = math.ceil(math.max(b, 1) / u)
|
||||
print(c)
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user