BIP38 decode not work
Noname400 opened this issue · comments
dec, pub_key_mode = Bip38Decrypter.DecryptEc('6PYUp3UADsJJyLcUd2Zf5zBoHYjbf3opd94wg39W2dKvPQPuHRhPNGaunD', 'ab123')
Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug 1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
from bip_utils import Bip38PubKeyModes, Bip38Decrypter, Bip38Encrypter, Bip38EcKeysGenerator
dec, pub_key_mode = Bip38Decrypter.DecryptEc('6PYUp3UADsJJyLcUd2Zf5zBoHYjbf3opd94wg39W2dKvPQPuHRhPNGaunD', 'ab123')
Traceback (most recent call last):
File "", line 1, in
File "C:\Python310\lib\site-packages\bip_utils\bip\bip38[bip38.py](https://bip38.py/)", line 128, in DecryptEc
return Bip38EcDecrypter.Decrypt(priv_key_enc, passphrase)
File "C:\Python310\lib\site-packages\bip_utils\bip\bip38\bip38_ec.py", line 413, in Decrypt
raise ValueError(f"Invalid prefix ({BytesUtils.ToHexString(prefix)})")
ValueError: Invalid prefix (0142)
WIF - L3YNu8BUaZ7YiknRS7jtMX35U8AsHzXjfekSRCwAwVMZRzZs1jiq
PASS - ab123
bip38 - 6PYUp3UADsJJyLcUd2Zf5zBoHYjbf3opd94wg39W2dKvPQPuHRhPNGaunD
Hi,
that key is not encrypted using EC multiplication (in fact the prefix is 0x0142
), so you shall use the other method:
dec, pub_key_mode = Bip38Decrypter.DecryptNoEc('6PYUp3UADsJJyLcUd2Zf5zBoHYjbf3opd94wg39W2dKvPQPuHRhPNGaunD', 'ab123')
Regards
Emanuele