equal
deleted
inserted
replaced
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 |