Aes_128_cbc and aes_128_ctr Algorithm

Source: Internet
Author: User

AES algorithm. The Group length is 128 bits, and the key length can be 128, 192, or 256 bits.

Aes_128_cbc(Cipher Block Chaining)
1,The total number of bits in the plaintext must be a multiple of the block size, 128bit.
Encryption is to encrypt and splice each segment, and add IV to the header. The input includes AES key, IV, plaintext | padding, and the output is ciphertext;
During decryption, the input includes AES key, IV, and ciphertext, and the output is plaintext.

2,CBC encryption: C1 =Ciphk(P1 limit IV );
Cj =Ciphk(PJ platinum Cj-1) for J = 2... N.
CBC decryption: p1 =CIPH-1K(C1) Certificate IV;
PJ =Ciph-1 K(CJ) Fill Cj-1 for J = 2... N
Wherein, the IV value is 128 bits, and its generation reference is sp800-38a.pdf, P2;
For details about padding, refer to "sp800-38a.pdf" p24 and "RFC 2630;
Ciphk refers to the aes128 encryption function, and ciph-1 K refers to the aes128 decryption function.

3,Illustration
Please refer to "sp800-38a.pdf" P17.

 

Aes_128_ctr(Counter)

1. The total number of bits in the message is (n-1) B + u, where 1 ≤ U ≤ B.
Encryption is the encryption and splicing of each segment, and the initial counter is added to the header. The input includes AES key, initial counter, and plaintext. The output is ciphertext;
During decryption, the input includes AES key, initial counter, and ciphertext, and the output is plaintext.

2. CTR encryption: OJ =Ciphk(TJ) for j = 1, 2... N;
Cj = PJ export OJ for j = 1, 2... N-1;
C * n = p * n recordsMSBU (on ).
CTR decryption: OJ =Ciphk(TJ) for j = 1, 2... N;
PJ = CJ semantic OJ for j = 1, 2... N-1;
P * n = C * n recordsMSBU (on ).
Initial counter, that is, T1 is 128 bits, and its generation reference is sp800-38a.pdf, P26;
T2...... TN is generated through the incrementing function. For details, refer to 《sp800-38a.pdf "P25, which is actually to add 1 to the original base;
Ciphk refers to the aes128 encryption function;
MSB refers to the most significant bit.

3. Illustration
Please refer to "sp800-38a.pdf" P23.

 

Everything in this article is summarized from 《Sp800-38a.pdf.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.