util/uuid.lua
changeset 12979 d10957394a3c
parent 12359 a0ff5c438e9d
child 13321 e6a5f196fc1f
equal deleted inserted replaced
12978:ba409c67353b 12979:d10957394a3c
     4 --
     4 --
     5 -- This project is MIT/X11 licensed. Please see the
     5 -- This project is MIT/X11 licensed. Please see the
     6 -- COPYING file in the source package for more information.
     6 -- COPYING file in the source package for more information.
     7 --
     7 --
     8 
     8 
     9 local random = require "util.random";
     9 local random = require "prosody.util.random";
    10 local random_bytes = random.bytes;
    10 local random_bytes = random.bytes;
    11 local hex = require "util.hex".encode;
    11 local hex = require "prosody.util.hex".encode;
    12 local m_ceil = math.ceil;
    12 local m_ceil = math.ceil;
    13 
    13 
    14 local function get_nibbles(n)
    14 local function get_nibbles(n)
    15 	return hex(random_bytes(m_ceil(n/2))):sub(1, n);
    15 	return hex(random_bytes(m_ceil(n/2))):sub(1, n);
    16 end
    16 end