mail/util/uuid.lua
Athozus c052e5900e
Remove checking all UUIDs for generating new one
The risk is ridiculous compared to the performance lost, even for several millions of messages.
2024-04-04 15:06:28 +02:00

11 lines
321 B
Lua

-- source: https://gist.github.com/jrus/3197011
local random = math.random
function mail.new_uuid()
local template ='xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'
return string.gsub(template, '[xy]',
function (c)
local v = (c == 'x') and random(0, 0xf) or random(8, 0xb)
return string.format('%x', v)
end)
end