Mercurial > prosody-hg
comparison util/random.lua @ 7187:3d2c2f0809ee
util.crand: C binding to one of OpenSSL, Linux getrandom() or OpenBSD arc4random() CSPRNG
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Mon, 22 Feb 2016 18:44:43 +0100 |
| parents | 51cf09bb74eb |
| children | e7496cff1215 177873dc9cf3 |
comparison
equal
deleted
inserted
replaced
| 7186:9c3930bcbb72 | 7187:3d2c2f0809ee |
|---|---|
| 3 -- Copyright (C) 2008-2014 Waqas Hussain | 3 -- Copyright (C) 2008-2014 Waqas Hussain |
| 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 | |
| 9 local ok, crand = pcall(require, "util.crand"); | |
| 10 if ok then return crand; end | |
| 8 | 11 |
| 9 local urandom, urandom_err = io.open("/dev/urandom", "r"); | 12 local urandom, urandom_err = io.open("/dev/urandom", "r"); |
| 10 | 13 |
| 11 local function seed() | 14 local function seed() |
| 12 end | 15 end |
