aboutsummaryrefslogtreecommitdiffstats
path: root/doc/examples/python/rng_test.py
blob: 06c79b84e5a240d9590264e73a05b4822e361907 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/python

import botan

rng = botan.RandomNumberGenerator()

print "name", rng.name()

rng.add_entropy("blah")

print "random 16", rng.gen_random(16).encode("hex")
print "random 32", rng.gen_random(32).encode("base64"),

rng.reseed()

for i in range(0, 10):
    print rng.gen_random_byte(),
print

rng.add_entropy("blah")

print "random 16", rng.gen_random(16).encode("hex")