mvondracek / PA193_mnemonic_Slytherin

BIP39 Mnemonic Phrase Generator and Verifier
0 stars 3 forks source link

entropy-mnemonic conversions #19

Closed sobuch closed 4 years ago

sobuch commented 4 years ago

Should we include test cases for private functions? (its kind of design antipatern) If so, how to do it with current includes and so on?

mvondracek commented 4 years ago

Should we include test cases for private functions? (its kind of design antipatern) If so, how to do it with current includes and so on?

If there are tests for private functions, they depend on current implementation. If you change the private implementation, these tests will break. For example tests for _secure_seed_compare are more like doctests and can definitely be transformed into proper doctests if we do not want to test private functions. There is also question, whether everything except generate, recover, and verify should be private...

If you want to test private function, single underscore allows simple imports.

mvondracek commented 4 years ago

Please see #22, thanks.

mvondracek commented 4 years ago

Waits until #21 is merged. https://github.com/mvondracek/PA193_mnemonic_Slytherin/pull/19#discussion_r335148843

mvondracek commented 4 years ago

Updated from dev. Updated the program (mnemoniccli) and package init, because is_valid_mnemonic was removed. The program now uses EAFP instead of LBYL. Tests are OK now.

mvondracek commented 4 years ago

Detected bug #28. Added test in f0b267c, which will be failing until the bug is fixed.

ERROR: test_verify_invalid_mnemonic_too_long (PA193_mnemonic_Slytherin.test_mnemonic.TestMnemonicPublic)

Too long mnemonic phrase which should not be propagated to BPKDF2.

----------------------------------------------------------------------

Traceback (most recent call last):

  File "/home/travis/build/mvondracek/PA193_mnemonic_Slytherin/PA193_mnemonic_Slytherin/test_mnemonic.py", line 217, in test_verify_invalid_mnemonic_too_long

    verify(mnemonic, seed)

  File "/home/travis/build/mvondracek/PA193_mnemonic_Slytherin/PA193_mnemonic_Slytherin/mnemonic.py", line 217, in verify

    generated_seed = _generate_seed(mnemonic, seed_password)

  File "/home/travis/build/mvondracek/PA193_mnemonic_Slytherin/PA193_mnemonic_Slytherin/mnemonic.py", line 39, in _generate_seed

    return pbkdf2_hmac('sha512', mnemonic, passphrase, PBKDF2_ROUNDS, SEED_LEN)

OverflowError: password is too long.
sobuch commented 4 years ago

superceded by https://github.com/mvondracek/PA193_mnemonic_Slytherin/pull/36