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:
- 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).
- 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.
https://github.com/SergeyBel/AES
https://github.com/jbheard/AEScrypt
https://github.com/4thrun/aes
https://github.com/HUTOYP/AES128_ECB_PKCS5Padding
---------------------------------------------
https://github.com/kokke/tiny-AES-c
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
---------------------------------------------
Plaintext:
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
---------------------------------------------
Key:
d6d5fbc94fa63a8d95dcbf2e7b874f5f819d21a375471a99fac2c981d7dafffaf95b5f03b4eadadf0e223efaee787b62b55febb80e6743f8aec0dbae1f96eb9f
---------------------------------------------
Iv:
8cee7c6e27455ed363353caad7356038887fbe6d5aab2b4b0419672b823c6b7fe9791a296d50651a96ad52ac5ead6513cb14f72e7320dda27e50625ea346fe69
---------------------------------------------
Ciphertext:
b5d7daa268ab9467b5c92ce27212683aff0f14c702fbe6cad9b30bc0fc4f4ccbb131cc155809dfd9300af324427607619e76cd63cd2aed963db725058b90b44eb5d7daa268ab9467b5c92ce27212683aff0f14c702fbe6cad9b30bc0fc4f4ccbb131cc155809dfd9300af324427607619e76cd63cd2aed963db725058b90b44e
It can be seen that the data of the two blocks in the ciphertext are the same.
b5d7...b44eb5d7...b44e
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.
https://github.com/sngrotesque/SZQ