Post
Topic
Board Bitcoin Technical Support
Merits 13 from 3 users
Re: 1 BTC reward
by
PowerGlove
on 04/11/2024, 09:10:05 UTC
⭐ Merited by Coding Enthusiast (5) ,ABCbits (4) ,LoyceV (4)
(you missed the AES IV by the way)
Hmm... I don't think so...

There's no IV in ECB mode. (I mean, I know the master key is encrypted in CBC mode, but, if you look carefully, you'll see that I'm not trying to decrypt the master key, I'm just doing trial-decryptions on the padding.)

Think of it like this: doing a CBC decryption backwards doesn't need the IV until the last step (which would be the first step when going forwards, but I'm not doing that).



Just to be sure that I haven't confused myself (it does happen from time to time), I've re-checked the example I left in that post:

(*) The 32-byte AES key that I derive from "MasterExploder" is: 75b8558ad738faeb4903164f3c486c24bd6df1f848561914a7ad754d4e8531e4.

(*) For the sake of completeness, the IV (which I don't need) that I derive from that same passphrase is: 914defc64e4b44fcf105534a50da0185.

(*) The encrypted padding is: 0032153d50cbf924a2ac1dc5f6279436.

(*) Performing an AES-256-ECB decryption (with the key from the first step) yields: 45e5f858c67596646cd010927d5c1c25.

(*) Finally, xoring that with the middle 16 bytes (55f5e848d66586747cc000826d4c0c35) of the 48-byte encrypted master key yields: 10101010101010101010101010101010.

That all checks out, yeah?

(I haven't examined your code, but probably you'll find that the IV-related parts of it can be omitted.)