remove random.bytes, use ngu.random.bytes directly instead
This commit is contained in:
parent
d31fee5d22
commit
024655be6b
@ -7,8 +7,8 @@ import ngu
|
||||
# use this instead of rand%n
|
||||
randbelow = ngu.random.uniform
|
||||
|
||||
# for bytes
|
||||
bytes = ngu.random.bytes
|
||||
# for bytes, use ngu.random.byte(len)
|
||||
#bytes = ngu.random.bytes
|
||||
|
||||
# In-place list shuffle using Fisher-Yates algo
|
||||
#
|
||||
|
||||
@ -505,11 +505,13 @@ async def ephemeral_seed_generate_from_dice(nwords):
|
||||
await set_ephemeral_seed_words(words, meta='Dice')
|
||||
|
||||
def generate_seed():
|
||||
seed = random.bytes(32)
|
||||
# Generate 32 bytes of best-quality high entropy TRNG bytes.
|
||||
|
||||
seed = ngu.random.bytes(32)
|
||||
assert len(set(seed)) > 4 # TRNG failure
|
||||
# hash to mitigate possible bias in TRNG
|
||||
seed = ngu.hash.sha256s(seed)
|
||||
return seed
|
||||
|
||||
# hash to mitigate any possible bias in TRNG
|
||||
return ngu.hash.sha256d(seed)
|
||||
|
||||
async def make_new_wallet(nwords):
|
||||
# Pick a new random seed.
|
||||
|
||||
@ -86,7 +86,7 @@ Otherwise, press OK to continue.'''.format(n=num_parts), escape='2')
|
||||
parts = []
|
||||
for i in range(num_parts-1):
|
||||
if use_rng:
|
||||
here = random.bytes(vlen)
|
||||
here = ngu.random.bytes(vlen)
|
||||
assert len(set(here)) > 4 # TRNG failure?
|
||||
mask = ngu.hash.sha256d(here)
|
||||
else:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user