mirror of https://github.com/oxen-io/lokinet
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
351 B
C
18 lines
351 B
C
#include "params.h"
|
|
#include "randombytes.h"
|
|
#include "crypto_uint32.h"
|
|
#include "small.h"
|
|
|
|
void small_random(small *g)
|
|
{
|
|
crypto_uint32 r[p];
|
|
int i;
|
|
|
|
randombytes((unsigned char *) r,sizeof r);
|
|
for (i = 0;i < p;++i)
|
|
g[i] = (small) (((r[i] & 1073741823) * 3) >> 30) - 1;
|
|
/* bias is miniscule */
|
|
for (i = p;i < 768;++i)
|
|
g[i] = 0;
|
|
}
|