mirror of
https://github.com/SeedSigner/seedsigner.git
synced 2026-10-05 23:18:25 +00:00
Merge pull request #109 from jpph/0_4_5
make dice seed generation verifiable outside seedsigner
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
from embit import bip39
|
||||
from embit.bip39 import mnemonic_to_bytes, mnemonic_from_bytes
|
||||
import unicodedata
|
||||
|
||||
import hashlib
|
||||
|
||||
|
||||
def calculate_checksum(partial_mnemonic: list, wordlist):
|
||||
@@ -28,8 +28,7 @@ def generate_mnemonic_from_bytes(entropy_bytes):
|
||||
|
||||
|
||||
def generate_mnemonic_from_dice(roll_data: str):
|
||||
entropyinteger = int(roll_data, 6)
|
||||
entropy_bytes = entropyinteger.to_bytes(32, byteorder="little")
|
||||
entropy_bytes = hashlib.sha256(roll_data.encode()).digest()
|
||||
|
||||
# Return as a list
|
||||
return bip39.mnemonic_from_bytes(entropy_bytes).split()
|
||||
|
||||
Reference in New Issue
Block a user