local SOME_PRIME = 16777213 function CheckSum(text) local counter = 1 local sum = 1 for i=1,string.len(text) do local c = string.byte(text, i) counter = counter + (c + i) * 17 sum = sum + c * i end counter = counter * sum counter = math.mod(counter, SOME_PRIME) return string.format("%06x", counter) end