outsource hash function

This commit is contained in:
juhnsa committed 2025-08-26 16:14:10 +02:00
1 parent a64c72d4fc
commit b01b0d4eb5
2 files changed
+8 -8

No files matched your search

+7
View File
@@ -0,0 +1,7 @@
function hash(str)
local hash = 0
for i = 1, #str do
hash = (hash * 31 + string.byte(str, i)) % 65536
end
return string.format("%04X", hash)
end
+1 -8
View File
@@ -13,14 +13,7 @@ local function split(str, divider)
return t return t
end end
local function hash(str) dofile(dir..'hash.lua')
local hash = 0
for i = 1, #str do
hash = (hash * 31 + string.byte(str, i)) % 65536
end
return string.format("%04X", hash)
end
local function check_for_outdated_sessions() local function check_for_outdated_sessions()
local expired = 0 local expired = 0