I am a newbie to the cryptography world. I am working on a custom algorithm that encrypts the data multiple times and results in a cipher text. It uses a different key in each round to encrypt it. I researched a lot but couldn't find any answer to this question. What do you think is the ideal number for the rounds of encryption when the keys are different in each iteration? Could you show me some math?


  • 6
    $\begingroup$ optimal round count depends on the round structure, the key schedule, and the required security from the cipher $\endgroup$ Commented Oct 9, 2018 at 2:05
  • 2
    $\begingroup$ And if your "round" is actually just a standard application of a strong cipher like AES the answer is "1". $\endgroup$
    – SEJPM
    Commented Oct 9, 2018 at 6:47
  • 3
    $\begingroup$ @SEJPM That was already covered in the previous question of Lock Smith / Alex; this is a logical followup to that question. Unfortunately, we cannot really answer because of the reason stated by Richie: AES has 10 rounds (minimum) while Threefish has a simpler structure and 80 rounds.... $\endgroup$
    – Maarten Bodewes
    Commented Oct 9, 2018 at 18:00
  • $\begingroup$ and this question $\endgroup$
    – kelalaka
    Commented Oct 9, 2018 at 18:53

1 Answer 1


How many rounds cannot really be answered as it depends on the design of a (block) cipher. As many as required to withstand attacks found by crypt-analysis, plus quite few more in case the attacks are enhanced is the best we can do.

AES-128 has a mere 10 rounds, but those rounds are rather complex. Threefish has a less complex inner structure, but uses 72 rounds for the 256 bit version. There are attacks on Threefish that break 53 of 72 rounds. If the rounds could be compromised that easily for AES then it would be utterly broken. Fortunately the best known attack against AES-128 covers 8 rounds out of 10 - and because it is a key distinguishing attack it doesn't give all that much power to an attacker either.

So for your own cipher you'll have to try to find out how well it withstands all known attacks. This is very hard thing to do and it is unlikely that you will succeed without help. This is one of the reasons why it is hard to design a cipher. Another is to avoid meet-in-the-middle attacks between the rounds of the cipher.

  • $\begingroup$ Isn't there some really bad lightweight cipher that uses something like 700 rounds? $\endgroup$
    – forest
    Commented Jan 4, 2021 at 5:57
  • $\begingroup$ @Maarten Bodewes: I copy from here: en.wikipedia.org/wiki/Advanced_Encryption_Standard "It works on the 8-round version of AES-128, with a time complexity of 2^48, and a memory complexity of 2^32. 128-bit AES uses 10 rounds, so this attack is not effective against full AES-128." I want to ask this: How do I calculate the O(n) for every AES round? For instance a 3-round AES what O(n) does it have? $\endgroup$
    – someone
    Commented Aug 22, 2023 at 18:54
  • 1
    $\begingroup$ @just_learning The big $ \mathcal{O} $ notation is basically the order of operations. what an operation is is context specific. Normally you'd use it for a single block encrypt / decrypt of the block cipher (presuming that that's needed to attack the cipher). However, you can define it to be a single round as well; in short, $ \mathcal{O} $ is context specific. $\endgroup$
    – Maarten Bodewes
    Commented Aug 22, 2023 at 21:35
  • 1
    $\begingroup$ Who cares about that? You can just rent CPU time from a cloud provider. $\endgroup$
    – Maarten Bodewes
    Commented Aug 22, 2023 at 22:17
  • 1
    $\begingroup$ Sure, but I'd not try 2^48 if I had to wait for the result. 2^32 is only 4 billion, and your computer seems to manage 4 billion clock cycles sustained apparently (which I think is unlikely, but hey, maybe you've got one of these gaming laptops). $\endgroup$
    – Maarten Bodewes
    Commented Aug 23, 2023 at 16:45

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.