→Code: W/ the 2.0 changes, lua 5.1 renamed math.mod to math.fmod
(→Code: "mod" -> "math.mod" so it works outside of wow) |
(→Code: W/ the 2.0 changes, lua 5.1 renamed math.mod to math.fmod) |
||
| Line 35: | Line 35: | ||
local len = string.len(text); | local len = string.len(text); | ||
for i = 1, len, 3 do | for i = 1, len, 3 do | ||
counter = math. | counter = math.fmod(counter*8161, 4294967279) + -- 2^32 - 17: Prime! | ||
(string.byte(text,i)*16776193) + | (string.byte(text,i)*16776193) + | ||
((string.byte(text,i+1) or (len-i+256))*8372226) + | ((string.byte(text,i+1) or (len-i+256))*8372226) + | ||
((string.byte(text,i+2) or (len-i+256))*3932164); | ((string.byte(text,i+2) or (len-i+256))*3932164); | ||
end; | end; | ||
return math. | return math.fmod(counter, 4294967291); -- 2^32 - 5: Prime (and different from the prime in the loop) | ||
end | end | ||