key generation and PRNG for SR