5 ms·
Decoder ring Thanks for this -- after so long in the field I forget how much we're speaking in our own language until someone points it out. :-) One small cor
by cperciva 17y ago
Decoder ring
Thanks for this -- after so long in the field I forget how much we're speaking in our own language until someone points it out. :-)
One small correction:
HMAC(k, m) -->
SHA1(
("secret-key" XOR ("\x5c" * 10)) +
SHA1(
("secret-key" XOR ("\x36" * 10)) + "name=bob,withdraw=$200"))
The opad and ipad are block-length, and the key is 0-padded; so this should be
HMAC(k, m) -->
SHA1(
(("secret-key" + "\x00" * 54) XOR ("\x5c" * 64)) +
SHA1(
(("secret-key" + "\x00" * 54) XOR ("\x36" * 64)) + "name=bob,withdraw=$200"))
- tptacek 17y agoDoh. Thanks. Like I always say: I should not be trusted to implement crypto.
- cperciva 17y agoThis is a harmless mistake, for two reasons: 1. It doesn't actually weaken the MAC. 2. You'd never manage to ship that bug anyway, since all of your test cases would fail. I'm not saying that you should be trusted to implement crypto, but I don't think this particular error is a good reason for such a lack of trust. :-)