From 98537f77d47b92fc9871655236e53a8101f56c18 Mon Sep 17 00:00:00 2001 From: sa Date: Mon, 21 Mar 2022 02:20:13 -0400 Subject: [PATCH] made progress on the key setup --- encrypt.lua | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/encrypt.lua b/encrypt.lua index eef3138..1941380 100644 --- a/encrypt.lua +++ b/encrypt.lua @@ -15,6 +15,8 @@ c=length of key in words ]] +local inspect = require 'inspect' + local insert local concat local tostring @@ -23,9 +25,10 @@ local modf local w=64 local r=24 local b=16 -local K="globglogabgalab1" -local u=8 +local key="globglogabgalab1" +local u=8 --length of a word in bytes --local c=2 (with globglogabgalab1 as the key c should =2) +local L = {} --magic constants for 64bit word size (hex) local P = 0xb7e151628aed2a6b @@ -36,4 +39,32 @@ local Q = 0x9e3779b97f4a7c15 c = math.ceil(math.max(b, 1) / u) print(c) +--convert the key into an array of ints +local K = {string.byte(key, 1, -1)} +for i = 1, #K do +print(K[i]) +end + +--for i = b-1, down to 0 +--becuse lua starts tables at 1 this is changed to +L[c] = 0 +for i = b, 1, -1 do + if L[i/u] == nil then + L[i/u] = 0 + end + L[i/u] = (L[i/u] << 8) + K[i] + print(i) +end + +print(inspect(L)) + + + + + + + + + +