Encryption mode of block passwords

1. Xor by bit

  • The first step is to convert the data to binary

2. Ecb-electronic Code Book mode

The ECB mode is a simple encryption mode, clear data are divided into blocks of fixed size, and each block is encrypted separately, each block encryption and decryption are independent, and using the same method to encrypt, so can be parallel computing, this mode has a piece of cracking, using the same method can crack the other piece to get clear data. The plaintext data is an integer multiple of the block size before encryption

The go interface does not provide mode 3.04

Conclusion:

  • Features: Simple, high efficiency, regular ciphertext, easy to crack
  • The last plaintext group must be filled in
  • You don’t need to initialize vectors

3. Cbc-cipher Block Chaining, which is a chain of Cipher blocks

In CBC mode, each group shall perform xOR operation with the encrypted data of the previous group before encryption. Initialization vector IV shall be used for xOR operation before encryption of the first data block. CBC mode is one of the most commonly used encryption modes. Its main disadvantages are that the encryption is continuous, cannot be processed in parallel, and like ECB message blocks must be filled to integer multiples of the block size

Conclusion:

  • Features: Ciphertext is irregular and often used for encryption
  • The last plaintext group needs to be populated
  • An initialization vector is required, and the initialization vector used for encryption and decryption must be the same

4. Cfb-cipher FeedBack, ciphertext FeedBack mode

In CFB mode, the ciphertext of the previous group is encrypted and the plaintext of the current group is xOR calculated to generate the ciphertext of the current group. In the first step, the initialization vector is encrypted. In this mode, data filling is not required, including OFB mode and CTR mode mentioned later

Conclusion:

  • Features: Ciphertext is irregular. Plaintext is grouped with data streams in bitwise xor mode to generate ciphertext
  • An initialization vector is required, and the initialization vector used for encryption and decryption must be the same
  • You don’t need to fill

5. Ofb-output FeedBack, Output and FeedBack mode

In OFB mode, the output of the cipher algorithm is fed back to the input of the cipher algorithm, that is, the output of the previous cipher algorithm is the input of the current block cipher algorithm. In OFB mode, the plaintext is not directly encrypted by the cipher algorithm, but is generated by the xOR of the plaintext grouping and the output of the cipher algorithm. In this aspect, OFB and CFB mode are very similar

Conclusion:

  • Features: Ciphertext is irregular. Plaintext is grouped with data streams in bitwise xor mode to generate ciphertext
  • An initialization vector is required, and the initialization vector used for encryption and decryption must be the same
  • You don’t need to fill

6. Ctr-countter, counter mode

CTR mode is a stream cipher that generates the key stream by encrypting the accumulated counter successively. The final ciphertext grouping is obtained by xOR between the bit sequence obtained by encrypting the counter and the plaintext grouping

Conclusion:

  • Features: Ciphertext is irregular. Plaintext is grouped with data streams in bitwise xor mode to generate ciphertext
  • You don’t need to initialize vectors
  • You don’t need to fill