# HG changeset patch # User Kim Alvefur # Date 1638400403 -3600 # Node ID f8d28021563370b9b165ee0535883d09372950cc # Parent b5b799a2a10c29535ccae99773123de37d353865 util.id: Add a 'tiny' variant Conversations uses this for its randomized resources. Presumably fine and collision resistant enough when you have a few devices at most. diff -r b5b799a2a10c -r f8d280215633 util/id.lua --- a/util/id.lua Thu Dec 02 01:14:55 2021 +0100 +++ b/util/id.lua Thu Dec 02 00:13:23 2021 +0100 @@ -19,6 +19,9 @@ return { -- sizes divisible by 3 fit nicely into base64 without padding== + -- for short lived things with low risk of collisions + tiny = function() return b64url_random(3); end; + -- close to 8 bytes, should be good enough for relatively short lived or uses -- scoped by host or users, half the size of an uuid short = function() return b64url_random(9); end;