I want to test an encryption algorithm for strength. It doesn't have to be strong, it just has to resist accidental cracking and say, a determined hacker with 10-hours to waste. (I wrote the crypto algorithm. Yes, I know that this is generally a bad idea but I think that I have good reason.)
What kind of tests should I do? So far I've tried this:
- Generate random A.
- Flip one random bit of A to make B.
- Check that the number of 1s in encrypt(a) XOR encrypt(b) fits a poisson distribution (except that the XOR never outputs 0).
Any other suggested tests?
About the encryption
It's a standard Fiestel Cipher designed to run in 3ns and be entirely combinational, no registers. (This is orders of magnitude faster than DES/AES/etc.) I do as many rounds as I can in 3ns, which is only about 6.
First I permute the order of the input bits.
Then for each bit on the left half of the input I XOR with it the output of a function F. F has input 3-bits and output 1-bit. The 3 input bits to F are selected from the right-half of the input. The output of F is a permutation of {00001111} so F is balanced. The 3 input bits to F are selected from the bits on the right-half so that each bit on the right half is used the same number of times (or as close as possible to that). Each "F" is generated randomly and independently one time.
Next I swap left and right halves of the result and do it again. Again, new "F" for each bit with new input.
All that is one round. I do it 6 times, each round with random, independently-generated F functions. 6 rounds take about 3ns. I've tried changing the number of rounds and the number of inputs to F, too.