Comparison

util/uuid.lua @ 12355:a0ff5c438e9d

util.hex: Deprecate to/from in favour of encode/decode, for consistency!
author Matthew Wild <mwild1@gmail.com>
date Fri, 04 Mar 2022 15:22:45 +0000
parent 7078:ec17115e3721
child 12975:d10957394a3c
comparison
equal deleted inserted replaced
12354:3ce3633527af 12355:a0ff5c438e9d
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 "util.random";
10 local random_bytes = random.bytes; 10 local random_bytes = random.bytes;
11 local hex = require "util.hex".to; 11 local hex = require "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