Patent ID: 11335213

Abstract:
The disclosure discloses a method and apparatus for encrypting data, and a method and apparatus for decrypting data. The method for encrypting data includes: acquiring a to-be-encrypted data block; executing a first encryption on the to-be-encrypted data block to obtain a data ciphertext; executing a hash operation on the to-be-encrypted data block to obtain an index key; designating a last ciphertext block as a first target ciphertext block, and decrypting the first target ciphertext block to acquire an index value of the first target ciphertext block; executing a preset operation on the index value of the first target ciphertext block to obtain the index value of the to-be-encrypted data block, and executing a second encryption on the index value of the to-be-encrypted data block based on the index key to generate an index ciphertext; and combining the data ciphertext and the index ciphertext to generate a ciphertext block.