local alphabet = "abcdefghijklmnopqrstuvwxyz"

function getLetter(n, key, msg, data)
    key = tostring(key)
    local q = n
    local s = math.abs(n-(math.floor(n/#key)*#key))
    if s == 0 then
        s = 5
    end
    local a = tonumber(key:sub(s, s))
    for i = 1, #alphabet do
       if msg:sub(n, n) == alphabet:sub(i, i) then
          n = i 
          break
       end
    end
    if data == "add" then
        n = n + a
    else
        n = n - a
    end
    local c = math.abs(n-(math.floor(n/#alphabet)*#alphabet))
    return alphabet:sub(c, c)
end

function decrypt(msg, key)
    local e = ""
    for i = 1, #msg do
        local letter = " "
        if msg:sub(i, i) ~= " " then
            letter = getLetter(i, key, msg, "sub")
        end
        e = e .. letter
    end
    return e
end

function encrypt(msg, key)
    local e = ""
    for i = 1, #msg do
        local letter = " "
        if msg:sub(i, i) ~= " " then
            letter = getLetter(i, key, msg, "add")
        end
        e = e .. letter
    end
    return e
end
local a = io.read()
print(encrypt(a, 7852934652347))

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: