7 #ifndef SECP256K1_TESTRAND_IMPL_H 8 #define SECP256K1_TESTRAND_IMPL_H 43 ret &= ((~((
uint32_t)0)) >> (32 - bits));
59 static const int addbits[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 1, 0};
71 bits = bits + addbits[bits];
72 mult = ((~((
uint32_t)0)) >> (32 - bits)) / range;
73 trange = range * mult;
81 return (mult == 1) ? x : (x % range);
92 memset(bytes, 0, len);
93 while (bits < len * 8) {
98 while (now > 0 && bits < len * 8) {
99 bytes[bits / 8] |= val << (bits % 8);
static uint64_t secp256k1_test_rng_integer
Definition: testrand_impl.h:19
static void secp256k1_rfc6979_hmac_sha256_initialize(secp256k1_rfc6979_hmac_sha256 *rng, const unsigned char *key, size_t keylen)
static void secp256k1_rand256(unsigned char *b32)
Definition: testrand_impl.h:86
static uint32_t secp256k1_rand_bits(int bits)
Definition: testrand_impl.h:34
static SECP256K1_INLINE uint32_t secp256k1_rand32(void)
Definition: testrand_impl.h:26
static int secp256k1_test_rng_integer_bits_left
Definition: testrand_impl.h:20
static SECP256K1_INLINE void secp256k1_rand_seed(const unsigned char *seed16)
Definition: testrand_impl.h:22
#define SECP256K1_INLINE
Definition: secp256k1.h:123
unsigned int uint32_t
Definition: stdint.h:21
unsigned long long uint64_t
Definition: stdint.h:22
static secp256k1_rfc6979_hmac_sha256 secp256k1_test_rng
Definition: testrand_impl.h:16
static uint32_t secp256k1_rand_int(uint32_t range)
Definition: testrand_impl.h:47
static uint32_t secp256k1_test_rng_precomputed[8]
Definition: testrand_impl.h:17
static void secp256k1_rand256_test(unsigned char *b32)
Definition: testrand_impl.h:106
static void secp256k1_rand_bytes_test(unsigned char *bytes, size_t len)
Definition: testrand_impl.h:90
static int secp256k1_test_rng_precomputed_used
Definition: testrand_impl.h:18
static void secp256k1_rfc6979_hmac_sha256_generate(secp256k1_rfc6979_hmac_sha256 *rng, unsigned char *out, size_t outlen)