I'm encrypting one of the standard TDEA/3DES/DES-EDE test vectors with openssl:

$key = pack('H*', '0123456789ABCDEF' . '23456789ABCDEF01' . '456789ABCDEF0123');

$result = openssl_encrypt('The quick brown fox jump', 'des-ede3', $key, OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING);

echo chunk_split(bin2hex($result), 16, ' ');

(des-ede3 is ecb mode)

This gives 1ccf23869d09333e cce21c8112256fe6 68d5c05dd9b6b900 as the result.

But the test vector for TDEA in ECB mode in NIST SP 800-67 Appendix B.1 states that the output should be A826FD8CE53B855F CCE21C8112256FE6 68D5C05DD9B6B900.

So what's up?


1 Answer 1


It looks like there's an error in the test vector.

The text of Appendix B.1 states:

P1 = “The quic” = 5468652071756663

... which is incorrect.

The hex encoding of The quic is actually 5468652071756963 (note the transposition of the i/69 to an f/66 in the encoding.

e.g. encrypting the test vector as intended:

$ echo -n 'The quick brown fox jump' | openssl  des-ede3 -nosalt -nopad -K '0123456789ABCDEF23456789ABCDEF01456789ABCDEF0123'  | xxd -c 8 -ps

... and encrypting the test vector as hex encoded:

$ echo -n 'The qufck brown fox jump' | openssl  des-ede3 -nosalt -nopad -K '0123456789ABCDEF23456789ABCDEF01456789ABCDEF0123'  | xxd -c 8 -ps

It looks like this error has been in NIST SP 800-67 since version 1 in 2004.

  • 3
    $\begingroup$ Now that's just funny, finding a typo in one of the DES test vectors, and an evil one at that 666 indeed :) $\endgroup$
    – Maarten Bodewes
    Commented Dec 21, 2014 at 14:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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