0
$\begingroup$

The specification here seems quite clear, but unfortunately I'm still doing something wrong...

I have this (single small c++ file) repository which very straightforwardly follows the password/wallet verification process. However, the result of my cryptographic operations do not match with the wallet's mac key (the signal that the password is correct).

I have verified that thisisatestwallet.json (included in the repository) does open with the password thisisatestwallet, and the spec seems so simple there isn't much room for me to screw up. And yet...

If anyone could glance at that and tell me what I'm doing wrong, I'd appreciate it!

The output I'm currently getting is as follows:

pkey:           2F299FEF2CA3390C63DABA7A13BA4CE9D60B7FC1E58DAFD5E1089D32CFD7219C
ciphertext:                                                                     C6D18F78AF6E5E7CEA4AB804D8B9A5F974CCF92EA2537416B90ABEBD77C6B580
cipher input:                                   D60B7FC1E58DAFD5E1089D32CFD7219CC6D18F78AF6E5E7CEA4AB804D8B9A5F974CCF92EA2537416B90ABEBD77C6B580
keccak out:     7D31B612939A26418CAB1DF332D27B711CAACAA7A119013A01E1DB75DE508DAA
mac:            89655FD4BB9CCF9DE0D8F1A78025A8616C9416EC700CFAAFEF17E76C7C47338E
$\endgroup$
2
$\begingroup$

Ah, the misunderstanding was that the spec says SHA-3 (Keccak-256), which I had assumed was SHA-3-256, but is actually Keccak-1600(256), which is part of the SHA-3 standard. Fixed.

$\endgroup$
4
  • $\begingroup$ Yeah. SHA-3-* and SHAKE-* are slightly different. $\endgroup$
    – DannyNiu
    Sep 19 at 7:46
  • $\begingroup$ It would be nice (and give you internet points) if you accepted this answer. $\endgroup$
    – fgrieu
    Sep 19 at 8:39
  • $\begingroup$ @fgrieu Accepting own answer doesn't earn points if I remember correctly. $\endgroup$
    – DannyNiu
    Sep 19 at 9:29
  • $\begingroup$ @DannyNiu : according to this and my experience, accepting one's answer earns 2 reputation points rather then the usual 15. That's to still give an incentive to mark the question as settled, which in turn prevents it from poping up periodically, as the present one did. Also, I was using "internet points" as something more general: a virtual counter of how one is contributing to a better web. $\endgroup$
    – fgrieu
    Sep 19 at 10:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.