Mercurial > prosody-hg
comparison util/random.lua @ 8241:e7496cff1215
util.random: Remove obsolete noop seed function
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Sat, 16 Sep 2017 17:22:51 +0200 |
| parents | 3d2c2f0809ee |
| children | 292f61d9d30a |
comparison
equal
deleted
inserted
replaced
| 8240:c803624cae3d | 8241:e7496cff1215 |
|---|---|
| 9 local ok, crand = pcall(require, "util.crand"); | 9 local ok, crand = pcall(require, "util.crand"); |
| 10 if ok then return crand; end | 10 if ok then return crand; end |
| 11 | 11 |
| 12 local urandom, urandom_err = io.open("/dev/urandom", "r"); | 12 local urandom, urandom_err = io.open("/dev/urandom", "r"); |
| 13 | 13 |
| 14 local function seed() | |
| 15 end | |
| 16 | |
| 17 local function bytes(n) | 14 local function bytes(n) |
| 18 return urandom:read(n); | 15 return urandom:read(n); |
| 19 end | 16 end |
| 20 | 17 |
| 21 if not urandom then | 18 if not urandom then |
| 23 error("Unable to obtain a secure random number generator, please see https://prosody.im/doc/random ("..urandom_err..")"); | 20 error("Unable to obtain a secure random number generator, please see https://prosody.im/doc/random ("..urandom_err..")"); |
| 24 end | 21 end |
| 25 end | 22 end |
| 26 | 23 |
| 27 return { | 24 return { |
| 28 seed = seed; | |
| 29 bytes = bytes; | 25 bytes = bytes; |
| 30 }; | 26 }; |
