Jump to content
  • 0

Enyby Can u fix this?


NewbieSquadArk

Question

-- Lua simple XOR encrypt by Ganlv
-- key = gg.prompt({"Enter Password :"}, {"0"}, {"number"})
key = "123"
-- load
local main = loadstring((function (bytes, key_)
    -- http://lua-users.org/wiki/BitUtils
    function bxor(a, b)
        local XOR_l =
        {
           {0, 1},
           {1, 0},
        }
        local pow = 1
        local c = 0
        while a > 0 or b > 0 do
            c = c + (XOR_l[(a % 2) + 1][(b % 2) + 1] * pow)
            a = math.floor(a / 2)
            b = math.floor(b / 2)
            pow = pow * 2
        end
        return c
    end

    local getDataBytes = function (bytes)
        local result = {}
        local i = 1
        local index = bytes[i]
        while (index >= 0) do
            result[i] = bytes[index + 1]
            i = i + 1
            index = bytes[i]
        end
        return result
    end

    local decode = function (bytes, key_)
        if #key_ <= 0 then
            return {}
        end
        local i = 1
        local j = 1
        for i = 1, #bytes do
            bytes[i] = bxor(bytes[i], string.byte(key_, j))
            j = j + 1
            if j > #key_ then
                j = 1
            end
        end
        return bytes
    end

    local bytesToString = function (bytes)
        local result = ""
        for i = 1, #bytes do
            result = result .. string.char(bytes[i])
        end
        return result
    end

    return bytesToString(decode(getDataBytes(bytes), key_))
end)({
    -- data
}, key))
if main then
    main()
else
    print("密码错误")
end
Link to comment
Share on other sites

5 answers to this question

Recommended Posts

20 hours ago, TopGEOYT said:

First wrong code is on first line. "--" delete this thing and write again. Also next error is on line 7. It isnot readable for gg so game gurdian cannot read .

Also u dont have getfile function and many problems are here 

Link to comment
Share on other sites

First wrong code is on first line. "--" delete this thing and write again. Also next error is on line 7. It isnot readable for gg so game gurdian cannot read .

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.