gurnec / decrypt_bitcoinj_seed

Decrypts and displays the seed mnemonic from from a bitcoinj-based HD wallet file.
42 stars 23 forks source link

How to overcome 'salt must be a byte string error'? #9

Open Rust64 opened 4 years ago

Rust64 commented 4 years ago

Good `morning,

I'm trying to recover my Multibit HD seed words using decrypt_bitcoinj_seed.py I don't know if anyone has used decrypt_bitcoinj_seed.py or not but I'm getting an error after it runs another python script in its arsenal called common.py with an error: raise TypeError('salt must be a byte string')

There are many opportunities for errors to be thrown in this python script, so if this one is overcome there could be others to follow. (Please see code at the bottom.) The code below shows the salt error.

C:\Python38\decrypt_bitcoinj_seed-master>py decrypt_bitcoinj_seed.py Traceback (most recent call last): File "decrypt_bitcoinj_seed.py", line 319, in <module> wallet = load_wallet(wallet_file, get_password) File "decrypt_bitcoinj_seed.py", line 132, in load_wallet key = pylibscrypt.scrypt(password.encode('utf_16_be'), salt, olen=32) File "C:\Python38\lib\site-packages\pylibscrypt\hashlibscrypt.py", line 49, in scrypt check_args(password, salt, N, r, p, olen) File "C:\Python38\lib\site-packages\pylibscrypt\common.py", line 49, in check_args raise TypeError('salt must be a byte string') TypeError: salt must be a byte string

Does anyone know how the salt would be edited so it becomes a byte string or is there a better alternative? Also, not that it matters since I have very little programming knowledge, why does the script need all the following to crack the seed words? - password, salt, N, r, p, olen The good news is the "check args" password script part passed. Here's the code I mentioned earlier about all the possibilities for errors to be thrown:

if not isinstance(password, bytes): raise TypeError('password must be a byte string') if not isinstance(salt, bytes): raise TypeError('salt must be a byte string') if not isinstance(N, numbers.Integral): raise TypeError('N must be an integer') if not isinstance(r, numbers.Integral): raise TypeError('r must be an integer') if not isinstance(p, numbers.Integral): raise TypeError('p must be an integer') if not isinstance(olen, numbers.Integral): raise TypeError('length must be an integer') if N > 2**63: raise ValueError('N cannot be larger than 2**63') if (N & (N - 1)) or N < 2: raise ValueError('N must be a power of two larger than 1') if r <= 0: raise ValueError('r must be positive') if p <= 0: raise ValueError('p must be positive') if r * p >= 2**30: raise ValueError('r * p must be less than 2 ** 30') if olen <= 0: raise ValueError('length must be positive')

If other errors arise, I will post them here; but I'm hoping it will just work and return my seed words!

adangert commented 2 years ago

Run with Python2.7 and this should not be an error. I made a new issue