util/id.lua
changeset 12115 f8d280215633
parent 12114 b5b799a2a10c
child 12979 d10957394a3c
equal deleted inserted replaced
12114:b5b799a2a10c 12115:f8d280215633
    17 end
    17 end
    18 
    18 
    19 return {
    19 return {
    20 	-- sizes divisible by 3 fit nicely into base64 without padding==
    20 	-- sizes divisible by 3 fit nicely into base64 without padding==
    21 
    21 
       
    22 	-- for short lived things with low risk of collisions
       
    23 	tiny = function() return b64url_random(3); end;
       
    24 
    22 	-- close to 8 bytes, should be good enough for relatively short lived or uses
    25 	-- close to 8 bytes, should be good enough for relatively short lived or uses
    23 	-- scoped by host or users, half the size of an uuid
    26 	-- scoped by host or users, half the size of an uuid
    24 	short = function() return b64url_random(9); end;
    27 	short = function() return b64url_random(9); end;
    25 
    28 
    26 	-- more entropy than uuid at 2/3 the size
    29 	-- more entropy than uuid at 2/3 the size