Pages:
Author

Topic: BIP38 python problem - page 5. (Read 897 times)

legendary
Activity: 3430
Merit: 10505
July 25, 2021, 11:28:31 PM
#2
The problem is I don't know they mean by that.
That is probably because you don't know how AES works which means you probably shouldn't implement BIP38 yourself and try to use an existing library that is well tested even in another language.

What the quote means is that you use AES with the following settings:
key size = 256 (bit) (the derived key from scrypt)
mode = ECB (each block is encrypted individually)
IV = new byte[16] (empty initialization vector)
padding = none

When decrypting, you split the decrypted key (extracted from the base58) into 2x 16-byte parts and decrypt using the AES instance you prepared above in 2 rounds to get the 2x 16-byte chunk of the actual private key.
sr. member
Activity: 1036
Merit: 350
July 25, 2021, 10:24:01 PM
#1
I can't seem to code bip38 in python based on the formal specification: https://github.com/bitcoin/bips/blob/master/bip-0038.mediawiki

Quote
This proposal makes use of the following functions and definitions:
•AES256Encrypt, AES256Decrypt: the simple form of the well-known AES block cipher without consideration for initialization vectors or block chaining. Each of these functions takes a 256-bit key and 16 bytes of input, and deterministically yields 16 bytes of output.

The problem is I don't know they mean by that. I'm not even sure python has that. Nothing that I have tried has worked. Which is a big disappointment. I'm using Python 3.7.

I guess the real problem and let me get on my soapbox here is that Bip38 wasn't taken very seriously and thus they don't even have a standard reference implementation for current versions of python lol.
Pages:
Jump to: