trezor / python-shamir-mnemonic

MIT License
165 stars 59 forks source link

Test vecotor result seems incorrect #13

Closed KimiWu123 closed 5 years ago

KimiWu123 commented 5 years ago

I tried test case 17~19, 20 and 23. I expected the 3rd string is the secret in the vector file, but it seems not. I got different results with cli 'restore'.

I got the following result by cli tool case17~19: '0x62101a7ce21ebae7893c51426d535c43' case20: '0xee9ec1ed13996aa575714bd3abb6b8947ac6c7add9cdef39ef55a722eded034d' case24: '0x8f75a27a9dceb390b10e06d576007c3e7b32ed8ba6b521d5ceaf601df27b48ed'

Do I misunderstand something?

Thanks.

andrewkozlik commented 5 years ago

The format of the test vectors is explained in https://github.com/satoshilabs/slips/blob/master/slip-0039.md#test-vectors, note that it also says that the passphrase "TREZOR" is used for all valid sets of mnemonics. So you need to do the recovery with passphrase (-p option), otherwise the CLI tool assumes an empty passphrase:

$ shamir recover -p

Enter a recovery share: eraser senior acrobat romp bishop medical gesture pumps secret alive ultimate quarter priest subject class dictate spew material endless market

Completed 1 of 2 groups needed: ✓ 1 of 1 shares needed from group eraser senior acrobat ✗ 0 shares from group eraser senior beard ✗ 0 shares from group eraser senior ceramic ✗ 0 shares from group eraser senior decision Enter a recovery share: eraser senior beard romp adorn nuclear spill corner cradle style ancient family general leader ambition exchange unusual garlic promise voice

Completed 2 of 2 groups needed: ✓ 1 of 1 shares needed from group eraser senior acrobat ✓ 1 of 1 shares needed from group eraser senior beard ✗ 0 shares from group eraser senior ceramic ✗ 0 shares from group eraser senior decision SUCCESS! Enter passphrase: TREZOR Repeat for confirmation: TREZOR Your master secret is: 7c3397a292a5941682d7a4ae2d898d11

andrewkozlik commented 5 years ago

I updated the README.rst with an explanation of the format of the test vectors: https://github.com/trezor/python-shamir-mnemonic#test-vectors

KimiWu123 commented 5 years ago

@andrewkozlik , Thank you!