I'm currently making my first cipher. What are some qualities I should strive for?

A few I've heard/thought of so far:

  1. Changing a single bit in the input should have a 50% average chance of changing each bit of output.

  2. The locations of flipped bits should have no pattern

  3. Each byte should have a 1/256 chance of not changing (basically #1 ^ 8)

  4. The number of bytes found in similar by search should be very few (I need to write down the math, but my estimate is around 5%)

Am I on the right track? What am I missing?

This is just a personal project for fun.

  • 1
    Is this a block cipher? (like AES) It is correct to assume that encrypted data should be indistinguishable from random data. The qualities you've listed in 1-3 address that component of a good cipher. However, that does not address how difficult it is to crack. A good cipher is hard/impossible to crack even if you get its source code. Really, this question should be removed and posted on Crypto Stack Exchange as they will be more inclined to give you design input. Here at Security Stack Exchange we'll quickly say never roll your own crypto for any production or security-sensitive app :-) – Bryan Field Aug 3 '16 at 13:36
  • 1
    Good cipher should be also very fast. – Aria Aug 3 '16 at 13:39
  • 1
    Not trying to make your own cipher is probably the first thing you learn in any cryptography class. It's completely impossible not to screw this up. – AdHominem Aug 3 '16 at 13:50
  • 1
    would this be better asked on crypto.SE? crypto.stackexchange.com +1 to never write your own crypto for anything that you want to be secure – Stu W Aug 3 '16 at 13:55
  • @GeorgeBailey Thank you for being so kind. I did not realize there was a Crypto Stack Exchange. I'll head over there. And for everyone else, just because I'm not going to succeed does not mean I won't learn anything. How can you not realize that? I can't believe how lame most coders are these days. – Seph Reed Aug 3 '16 at 18:51

I think you missed to make it immune against differential crpytoanalysis. But that means that you first have to study what differential cryptoanalysis actually is, and that is probably a bigger project than implementing a "fun" cipher...

| improve this answer | |

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