mnemonic: add comments
This commit is contained in:
@@ -209,10 +209,11 @@ class Mnemonic(Logger):
|
|||||||
bpw = math.log(len(self.wordlist), 2)
|
bpw = math.log(len(self.wordlist), 2)
|
||||||
num_bits = int(math.ceil(num_bits/bpw) * bpw)
|
num_bits = int(math.ceil(num_bits/bpw) * bpw)
|
||||||
self.logger.info(f"make_seed. prefix: '{prefix}', entropy: {num_bits} bits")
|
self.logger.info(f"make_seed. prefix: '{prefix}', entropy: {num_bits} bits")
|
||||||
|
# generate random
|
||||||
entropy = 1
|
entropy = 1
|
||||||
while entropy < pow(2, num_bits - bpw):
|
while entropy < pow(2, num_bits - bpw): # try again if seed would not contain enough words
|
||||||
# try again if seed would not contain enough words
|
|
||||||
entropy = randrange(pow(2, num_bits))
|
entropy = randrange(pow(2, num_bits))
|
||||||
|
# brute-force seed that has correct "version number"
|
||||||
nonce = 0
|
nonce = 0
|
||||||
while True:
|
while True:
|
||||||
nonce += 1
|
nonce += 1
|
||||||
|
|||||||
Reference in New Issue
Block a user