I am working on an encryption system called “Universe99”. really horrible name, ik
However, when I decrypt something with a piece of test code, it gives me this output result:
This is my test code that I used in the command bar:
local thing = require(game.ServerScriptService.ServerLogic.Modules.Encryption.Universe99)
local e = thing.toUniverse("Whydoidothistomahself")
print(e)
print(thing.toWorld(e))
and its output (with some hidden unicodes):
19:46:57.881 Xj|htokw}rt}|qy
x{ - Server (This is the encoded result, from toUniverse)
19:46:57.881 Whydoidothisnl`gcc - Server (This is the decoded result, from toWorld)
As you can see, the output returns some correct letters, but then just ends up not trying to receive the correct letters. This is the module code for my encoding system:
local universe99 = {}
function universe99.toUniverse(str)
assert(typeof(str) == "string", "Argument #1 of toUniverse must be a string.")
local encrypted = ""
for i=1, #str do
local letter = str:sub(i, i)
local point = utf8.codepoint(letter) + i
encrypted = `{encrypted}{utf8.char(point)}`
end
return encrypted
end
function universe99.toWorld(str)
assert(typeof(str) == "string", "Argument #1 of toWorld must be a string.")
local decrypted = ""
for i=1, #str do
-- pcall because roblox screams errors for absolutely no reason
local letter = str:sub(i, i)
local success, point = pcall(function()
return utf8.codepoint(letter)
end)
if success and typeof(point) == "number" then
point -= i
else
continue
end
decrypted = `{decrypted}{utf8.char(point)}`
end
return decrypted
end
return universe99