summaryrefslogtreecommitdiffstats
path: root/randomize.pyx
blob: 99cd0ab001adcd7b4b2ab1fb2626bd2a8742d640 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
cdef extern from "openssl/rand.h":
    void RAND_seed(
            const void *buf, int num)
    void RAND_add(const void *buf, int num, double entropy)
    int  RAND_status()
    void RAND_screen()

def rand_add(buf: bytes, num: int, entropy: float) -> None:
    assert isinstance(entropy, float)
    RAND_add(buf, num, entropy)

def rand_seed(buf: bytes, num: int) -> None:
    RAND_seed(buf, num)