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