summaryrefslogtreecommitdiffstats
path: root/randomize.pyx
diff options
context:
space:
mode:
Diffstat (limited to 'randomize.pyx')
-rw-r--r--randomize.pyx14
1 files changed, 14 insertions, 0 deletions
diff --git a/randomize.pyx b/randomize.pyx
new file mode 100644
index 0000000..99cd0ab
--- /dev/null
+++ b/randomize.pyx
@@ -0,0 +1,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)
+