I am very interested in encryption algorithms, especially AES encryption algorithm in symmetric encryption. To this end, I have studied a lot of theoretical knowledge about AES encryption algorithm and the code samples I can obtain.

I wrote a 512-bit encryption algorithm after referring to AES-CBC-256 mode in detail.

I named this mode SZQ-CBC-512, but the output result is almost the same as that of AES-ECB-256 mode (that is, the data between different blocks is the same).

I will describe this problem in detail:

  1. The avalanche effect is very perfect because it refers to "column mixing", "row shifting" and "sub bytes" of AES encryption algorithm (equivalent to another realization of an AES encryption algorithm).
  2. All inputs are 512 bits, that is to say, the blocks of "plaintext, key and ciphertext" are 64 bytes.

Then in the process of implementation, If you enter a byte stream with a length of 128 bytes and all of them are "00", you will get the data spliced by two blocks.

The two blocks will be the same.

These are the Github warehouses of the AES encryption algorithm code samples I refer to.

This is the code sample warehouse of AES encryption algorithm that I have learned and understood most.

The following is an example output of the plaintext, key and ciphertext of the SZQ encryption algorithm.

Hex print

It can be seen that the data of the two blocks in the ciphertext are the same.


However, I found that under the CBC mode of AES encryption algorithm, different blocks will not have duplicate blocks in a very large range.

So I would like to know how AES encryption algorithm achieves this.
The following is the source code warehouse of SZQ encryption algorithm I developed.


  • $\begingroup$ When properly used CBC not only would minimize the probability of duplicate ciphertext blocks to be negligible, but also given the same input plaintext to encrypt twice would produce completely different resulting ciphertexts. You may want to take a closer look at the importance of generating a (cryptographically strong-) random IV block to be used as input, each time you encrypt a plaintext with CBC. $\endgroup$
    – Amit
    Commented Feb 18, 2023 at 20:05
  • 1
    $\begingroup$ Note that, in the SZQ cipher, the RowsMix operation is not at all equivalent to the AES MixRows operation; in particular, it is not even close to being MDS (in the forward direction, you have have a delta on 2 bytes in and 1 byte out); MixRows being MDS is crucial for the proofs that AES is immune to linear/differential cryptanalysis. In addition, how were the sboxes chosen (and why do you believe that they give good linear/differential properties)? $\endgroup$
    – poncho
    Commented Feb 19, 2023 at 3:09
  • $\begingroup$ As for the generation of sbox, I first created a uint8 array of 256 bytes in length from 0 to 255, and then used a random algorithm to scramble it for 16 times. $\endgroup$ Commented Feb 19, 2023 at 5:30
  • $\begingroup$ At present, if SZQ cipher only has ECB mode, can you analyze the security of this algorithm? $\endgroup$ Commented Feb 19, 2023 at 5:33
  • $\begingroup$ As for analyzing the security of the cipher, well, the sbox does have decent sized differential and linear characteristics (about what one would expect from a random sbox). And, there may be sparse paths through the cipher (as I pointed out about the RowsMix operation). As for finding a concrete differential or linear characteristic through the bulk of the cipher, well, that'd be more work than I'm interested in. What appears to be much harder is showing that there isn't one - can you do that? If not, why do you believe it might be secure? $\endgroup$
    – poncho
    Commented Feb 20, 2023 at 21:01

1 Answer 1


Have a look at the diagram in the CBC section of Wikipedia's article on modes of operation.

As indicated in that section:

In CBC mode, each block of plaintext is XORed with the previous ciphertext block before being encrypted. This way, each ciphertext block depends on all plaintext blocks processed up to that point.


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.