Sha256: 2c6525dd22305b6a87bb86080199f1afea89789bfc41c166832ba58414eef0ee
Contents?: true
Size: 325 Bytes
Versions: 3
Compression:
Stored size: 325 Bytes
Contents
#include "randombytes.h" /* XXX: current implementation is limited to n<2^55 */ long long randommod(long long n) { long long result = 0; long long j; unsigned char r[32]; if (n <= 1) return 0; randombytes(r,32); for (j = 0;j < 32;++j) result = (result * 256 + (unsigned long long) r[j]) % n; return result; }
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ruby_nacl-0.1.2 | ext/ruby_nacl/NaCl/curvecp/randommod.c |
ruby_nacl-0.1.1 | ext/ruby_nacl/NaCl/curvecp/randommod.c |
ruby_nacl-0.1.0 | ext/ruby_nacl/NaCl/curvecp/randommod.c |