-- Before
local CRC_LIMIT = tonumber("FFFF", 16)
local function CheckSum(text)
local counter = 1
for i = 1,string.len(text) do
counter = counter + (string.byte(text, i) * 17 * i)
end
counter = math.mod(counter, CRC_LIMIT)
return string.format("%04X", counter)
end
-- After
local CRC_LIMIT = tonumber("FFFFFF", 16)
local function CheckSum(text)
local counter = 1
for i = 1,string.len(text) do
counter = counter + (string.byte(text, i) * 17 * i)
end
counter = math.mod(counter, CRC_LIMIT)
return string.format("%06X", counter)
end