From ad95f8ad56b3a1eeab20f6dd62c2a32004dcfd29 Mon Sep 17 00:00:00 2001 From: SomberNight Date: Mon, 22 Jan 2024 02:17:06 +0000 Subject: [PATCH] mnemonic: add comments --- electrum/mnemonic.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/electrum/mnemonic.py b/electrum/mnemonic.py index 5f1e57118..d458c68c7 100644 --- a/electrum/mnemonic.py +++ b/electrum/mnemonic.py @@ -209,10 +209,11 @@ class Mnemonic(Logger): bpw = math.log(len(self.wordlist), 2) num_bits = int(math.ceil(num_bits/bpw) * bpw) self.logger.info(f"make_seed. prefix: '{prefix}', entropy: {num_bits} bits") + # generate random entropy = 1 - while entropy < pow(2, num_bits - bpw): - # try again if seed would not contain enough words + while entropy < pow(2, num_bits - bpw): # try again if seed would not contain enough words entropy = randrange(pow(2, num_bits)) + # brute-force seed that has correct "version number" nonce = 0 while True: nonce += 1