Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reveal Initial Entropy Byte Array + Resulting Hash For Checksum, & Additional Proposal #257

Open
hatgit opened this issue Oct 1, 2018 · 1 comment

Comments

@hatgit
Copy link
Contributor

hatgit commented Oct 1, 2018

Proposal to Reveal Entropy as Byte Array and Resulting Hash Used For Checksum

For the sake of education/transparency for users who are otherwise advanced but don't wish to dive into the code, I would like to propose that in the advanced section when entropy is revealed, there perhaps be a field somewhere off from the center area (i.e. less important section) where the initial entropy formatted as a "byte array" is revealed, along with the resulting sha256 "hash" of that byte array, so users can verify the checksum against it in terms of leading bits needed.

Solution:

  • Reveal bytearray of initial entropy
  • Reveal sha256 hash of initial entropy either in hex or binary or both.

Reasoning:

I think this could help serve as proof for some that a particular checksum matches in terms of its first x number of bits from the hash of the bytes array, depending on the mnemonic length. I know this has been considered before in a prior commit, and I think it's worth adding for greater transparency on the front end, as well as for another potential modification/enhancement which I will mention here too:

Proposal to Reveal initial entropy when a mnemonic is pasted into the BIP39 Mnemonic field:

This proposal would simply reverse the steps that the tool already takes, and act as a way to validate mnemonics pasted into the tool, by also revealing the initial entropy of those mnemonics (which the tool doesn't currently do) I know this suggestion has also been considered before in prior related commits such as the one mentioned above.

Using a 12-word mnemonic here just as an example, if one were to paste this mnemonic into the tool the entropy is not shown:

wrong panda frost team edge typical rent throw buddy claw trick lonely

Solution:

The tool would take the first 11 bits of each word pasted, and the first 7 bits of the last word (total 128 bits using our 12-word example) and reveal those bits as the initial entropy (also in hex), while also disclosing the values used to compute the correct checksum in the 12th word, by converting those 128 bits to hex, then converting to a bytearray, then hashing that byte array with sha256, and using the first 4 bits to complete the last group of 7 bits to form the 12th word. It would again just be the reverse of the below steps the tool already takes:

entropy: feb3ed75ef5465d7ed970a1d6543a1c1

bytearray.fromhex('feb3ed75ef5465d7ed970a1d6543a1c1')

bytearray(b'\xfe\xb3\xedu\xefTe\xd7\xed\x97\n\x1deC\xa1\xc1')

hashlib.sha256(b'\xfe\xb3\xedu\xefTe\xd7\xed\x97\n\x1deC\xa1\xc1').hexdigest()

'dd54e40138553662a971be4aa17e471eee6c9aebab448fa7e2f075a34351b9de'```

bin(0xdd54e40138553662a971be4aa17e471eee6c9aebab448fa7e2f075a34351b9de)

'0b1101110101010100111001000000000100111000010101010011011001100010101010010111000110111110010010101010000101111110010001110001111011101110011011001001101011101011101010110100010010001111101001111110001011110000011101011010001101000011010100011011100111011110'

index as per tool : 1101

wrong panda frost team edge typical rent throw buddy claw trick lonely

Reasoning:

This would improve the usefulness of the tool in cases where users have created their mnemonics on other bip-39 compatible software but wish to dissect those mnemonics into their initial entropy states and for validation/confirmation and backup purposes.

@cernekee
Copy link
Contributor

cernekee commented Oct 28, 2018

Proposal to Reveal initial entropy when a mnemonic is pasted into the BIP39 Mnemonic field

I submitted a PR to allow converting mnemonics back into raw hex entropy strings: #271

This is intended to work the same way as the bip39-mnemonic-to-entropy command from App::BIP39Utils in CPAN. Basic idea is that many popular wallets want you to back up your recovery seed using BIP39 mnemonics. If you can convert that string back into a 32 byte hex value, then you can run your seed through ssss-split -x -s 256 and get 32-byte hex shares. Each of those shares can itself be encoded using BIP39, which is much more user-friendly than writing down 64-128 hex digits.

Not 100% sure that's what you're looking for, but maybe this helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants