Take the 2-minute tour ×
Cryptography Stack Exchange is a question and answer site for software developers, mathematicians and others interested in cryptography. It's 100% free, no registration required.

While implementing ciphers (/hash functions, ...), I often face this problem: Where to find test vectors for it; so that I can guarantee my program is correct. It is generally a tedious job to find test cases, so I planned to post this as a question here.

This question is about gathering test vectors for several ciphers (/hash functions, ...). The list of ciphers includes (but not limited to): RC4, all ciphers from eStream, DES (round-wise, if possible), 3DES, AES, ...

For a head-start, I put test cases of RC4 (correct me if I am wrong):

Key (255, 255, 0, 255) Keystream 23, 0, 135, 229, 197, 74, 253, 202, 72, 83, ...

Key (0, 0, 0, 255, 127, 31) Keystream 40, 172, 142, 137, 101, 124, 164, 50, 0, 172, ...

share|improve this question
    
NIST provides test values for DES, AES, and AES candidate ciphers. eStream submissions should have also included a test value file. –  Richie Frame Jul 30 at 4:41

1 Answer 1

For any of the algorithms approved by NIST you can usually find the test vectors in the Cryptographic Algorithm Validation Program (CAVP) - for instance for 3DES in appendix B and AES in appendix C. Test vectors are usually found in one of the appendixes or later sections of the documents.

For any others you should first look to the standard documents, preferably RFC's - for instance for RC4. If the standard documents do not contain test vectors then take an addition look at the company or organization; they often would have a separate document with test vectors. Some standards, such as the PKCS standards may also be referenced or copied by other standards, so if you cannot find it in one document you may want to look for copies. In general, cryptographic competitions require the submitter of proposals to include test vectors.

If you cannot find it that way you will have to rely on Google, or a forum such as this one. Or you could take a reference implementation and test your implementation against that. If that is not available, try and generate them yourself from the leading implementation.

Official test vectors are not always available, even in this day and age. If they are, they may not be complete in the sense that they would cover all possible code paths.

share|improve this answer
    
The standard organizations, especially ISO, should take more care with this regards and only standardize algorithms and protocols that supply a full suite of test vectors. –  Maarten Bodewes - owlstead Jul 30 at 8:26

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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