Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- import time
- from mnemonic import Mnemonic
- if __name__ == '__main__':
- if len(sys.argv) < 2:
- print("Suggested usage: rng-mnemonic <keys number> ")
- sys.exit(0)
- try:
- n = int(sys.argv[1])
- except ValueError:
- print("Keys number must be integer")
- #OneRNG provides instructions about generator availability and activity
- #other way to ensure RNG is working is to call cat /dev/random > /dev/null in bash
- print("Checking generator. Look at the LED")
- time.sleep(1.)
- with open('/dev/random', 'rb') as rnd:
- rnd.read(1024*16)
- time.sleep(1.)
- #real generation
- with open('/dev/random', 'rb') as rnd:
- for i in range(0, n):
- print("\nKey: {}".format(i))
- m = Mnemonic("english")
- print("Mnemonic: {}".format(m.to_mnemonic(rnd.read(32))))
- print("Completed")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement