for (int i = 0; i < 16; i++)
{
wellrng512_state[i] = fgetc(urandom);
}
fclose(urandom);
return 0;
}
uint32_t random_wellrng512()
{
uint32_t a, b, c, d;
a = wellrng512_state[wellrng512_index];
c = wellrng512_state[(wellrng512_index+13)&15];
b = a^c^(a<<16)^(c<<15);
c = wellrng512_state[(wellrng512_index+9)&15];
c ^= (c>>11);
a = wellrng512_state[wellrng512_index] = b^c;
d = a^((a<<5)&0xDA442D24UL);
wellrng512_index = (wellrng512_index + 15)&15;
a = wellrng512_state[wellrng512_index];
wellrng512_state[wellrng512_index] = a^b^d^(a<<2)^(b<<18)^(c<<28);
return wellrng512_state[wellrng512_index];
}
Это криптостойкий рандом?
нет
Почему?
Обсуждают сегодня