The invention relates to the technical field of digital images, in particular to an image
encryption and decryption method and device based on RISC-V, equipment, a storage medium and a
computer program product. According to the method, an initial key is written into a
coprocessor based on a preset extension instruction, and the internal state of the
chaotic system is configured based on the initial key; based on the internal state of the
chaotic system,
sponge iteration is carried out, a
random sequence is generated, and an image abstract is output; writing the storage position information of the
plaintext image into a
coprocessor, and enabling the
coprocessor to read the
plaintext image pixel by pixel in a direct storage access mode to obtain a pixel
stream; in the coprocessor, performing reversible
confusion operation and reversible
diffusion operation on the sequence of the pixel flow to obtain a processed pixel flow; and in a decryption stage, an internal state which is the same as that of the
chaotic system is constructed based on the image abstract, and the processed pixel
stream is subjected to reverse operation according to the same hardware logic which is multiplexed in a
reverse order, so that the original pixel
stream is obtained, and the efficiency of image
encryption and decryption is improved.