Where can I find test vectors for ciphers?

While implementing ciphers and hash functions, I often face a problem: where to find test vectors for it; so that I can guarantee my program is working correctly. It is generally a tedious job to find test cases.

Currently I am trying to gather test vectors for several ciphers and hash functions; including (but not limited to): RC4, all ciphers from eStream, DES (round-wise, if possible), 3DES, AES, …

To avoid looking in the wrong places: Where can I find test vectors for ciphers?

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, ...


Related:

• 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 '14 at 4:41
• Here I try to put links of test-vectors for ciphers from different sources: 1. github.com/cantora/avr-crypto-lib/tree/master/testvectors 2. github.com/mellery/ece5580/blob/master/python/LED2-byte-TestVectors.txt 3. opensource.apple.com//source/OpenSSL098/OpenSSL098-35/src/test/evptests.txt – yyyy0000 Jun 22 '16 at 17:05
• NIST not available at the time of writing this comment (Jan 2019) commerce.gov/news/blog/2018/12/… – rustyMagnet Jan 4 '19 at 11:07
• For PRESENT cipher: crypto.ruhr-uni-bochum.de/imperia/md/content/texte/publications/… – yyyy0000 Jan 14 at 11:20

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. Never just test against test vectors and think your implementation is sound or secure if they succeed; provide good coverage and remember to test your own corner cases.

• 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 Jul 30 '14 at 8:26
• NIST site now says: "Due to the lapse in government funding, csrc.nist.gov and all associated online activities will be unavailable until further notice." – rustyMagnet Jan 4 '19 at 11:05
• Yes, and it simply times out if you request the PDF directly. In general presidents try to first discuss e.g. funding of a border wall instead of trying to push it through unexpected, because he kinda forgot about it. Anyway, regardless of anybodies political thoughts, nothing we can do about it from here. I'm not going to provide links to e.g. the wayback machine (hint). – Maarten Bodewes Jan 4 '19 at 11:10