File: rng_test.py

package info (click to toggle)
botan1.10 1.10.8-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 12,288 kB
  • sloc: cpp: 61,853; python: 1,687; asm: 1,247; ansic: 252; perl: 89; sh: 52; makefile: 38; lisp: 34
file content (22 lines) | stat: -rwxr-xr-x 384 bytes parent folder | download | duplicates (6)
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")