Data update

This commit is contained in:
Ingy döt Net 2025-08-11 18:05:26 -07:00
parent 4d5544505c
commit 4924dd0264
3073 changed files with 55820 additions and 4408 deletions

View file

@ -0,0 +1,20 @@
local function caesar(s, k, e=true)
-- Parameters: s (string), k (key)
-- e (true=encode, false=decode)
if !e do k=-k end
local out = ""
for i = 1, #s do
local c = s[i]
if c:islower() then
out ..= string.char((c:byte() - 97 + k) % 26 + 97)
elseif c:isupper() then
out ..= string.char((c:byte() - 65 + k) % 26 + 65)
else
out ..= c
end
end
return out
end
print(caesar("The quick brown fox jumps over the lazy dog.", 3))
print(caesar("Wkh txlfn eurzq ira mxpsv ryhu wkh odcb grj.", 3, false))