mardi 13 mars 2018

Which randomization method is better?

pybitcointools (https://github.com/vbuterin/pybitcointools) generates a bitcoin private key using the following function:

import hashlib
def random_key():
    entropy = random_string(32) \
        + str(random.randrange(2**256)) \
        + str(int(time.time() * 1000000))
    return sha256(entropy)

in other places I saw a simpler implementation:

import os
os.urandom(32).hex()

I wonder which is more random, what is safer to use?




Aucun commentaire:

Enregistrer un commentaire