Image encryption method and device, electronic equipment, storage medium and program product
By splitting the Internet of Vehicles into small-sized sub-blocks and scrambling and independent encryption, the problem of low security in the existing technology is solved, and efficient and secure image transmission in the Internet of Vehicles environment is achieved.
Patent Information
- Application Number
- CN202411557646.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-04
- Publication Date
- 2025-02-11
AI Technical Summary
In the prior art, the image encryption method has low security, especially in the Internet of Vehicles environment. After the key is leaked, the entire encryption system is easily cracked, resulting in a threat to image data security.
By splitting the Internet of Vehicles into multiple small-sized sub-blocks, these sub-blocks are first scrambled, and then each sub-block is independently encrypted. Even if some keys are cracked, they can only access part of the image and cannot recover the entire image, reducing the risk of global key leakage.
This method optimizes the encryption process in an adaptive environment of the Internet of Vehicles, reduces the encryption processing time, and can meet the real-time and security requirements of the Internet of Vehicles, ensuring efficient and secure transmission of target encrypted images in the Internet of Vehicles.
Smart Images

Figure CN119420844A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of information security technology, and in particular to an image encryption method, device, electronic device, storage medium and program product. Background Art
[0002] With the rapid development of Internet of Vehicles (IoV) technology, information exchange and sharing between vehicles are becoming more frequent, and the demand for transmission of multimedia data, including images, in IoV has increased significantly. However, data transmission in IoV environments faces many security challenges, such as data leakage, tampering, and illegal access. The secure transmission of confidential images, such as vehicle location, road condition monitoring, and driver privacy, in IoV is particularly important.
[0003] Image encryption is a technology that protects the security of image data. It converts images into a form that cannot be directly recognized through a specific algorithm to prevent unauthorized access and interpretation. The basic idea of image encryption is to transform the original image data through a mathematical algorithm so that the transformed data is unrecognizable or difficult to understand for unauthorized users.
[0004] The existing image encryption method uses a global key for encryption. Once the key is leaked, the entire encryption system will be cracked and all encrypted images will face security threats. In the Internet of Vehicles environment, this risk is particularly prominent, because once the key of a certain link is cracked, the security of the entire system will be seriously threatened. Therefore, the existing image encryption method has low security. Summary of the invention
[0005] The present disclosure provides an image encryption method, device, electronic device, storage medium and program product to solve the problem of low security of image encryption methods in the prior art.
[0006] In a first aspect, the present disclosure provides an image encryption method, comprising: Based on the real-time transmission performance requirement information of the Internet of Vehicles image in the Internet of Vehicles, segmenting the Internet of Vehicles image to obtain a first target image block; Scrambling the first target image blocks to obtain second target image blocks; Performing bidirectional diffusion encryption on the second target image block to obtain a target encrypted image block; The target encrypted image is divided into blocks and integrated to obtain a target encrypted image.
[0007] In one embodiment, the real-time transmission performance requirement information of the connected vehicle image in the connected vehicle is determined by: Acquiring at least one of network status information, vehicle location information, and vehicle driving data; Performing a real-time demand analysis based on at least one of the network status information, the vehicle location information, and the vehicle driving data to obtain the real-time demand for image data transmission of the Internet of Vehicles; According to the real-time requirement, real-time transmission performance requirement information of the connected vehicle image in the connected vehicle is determined.
[0008] In one embodiment, segmenting the Internet of Vehicles image based on the real-time transmission performance requirement information of the Internet of Vehicles image in the Internet of Vehicles to obtain the first target image block includes: Performing three-channel RGB decomposition on the Internet of Vehicles image to obtain three single-channel image data; According to the real-time transmission performance requirement information, the image data of each single channel is segmented to obtain the first target image block of each single channel.
[0009] In one embodiment, scrambling the first target image blocks to obtain second target image blocks includes: generating a first key; Based on the first key, position scrambling is performed on the first target image block of each single channel to obtain the position scrambled block of each single channel; generating a second key; Based on the second key, pixel values of the position scrambled blocks of each single channel are scrambled to obtain the second target image blocks of each single channel.
[0010] In one embodiment, the first target image block of each single channel is positionally scrambled based on the first key to obtain the position scrambled block of each single channel, including: Converting the single-channel first target image blocks into an image block matrix; Converting the first key into an initial two-dimensional key matrix; The elements in the initial two-dimensional key matrix are sorted in ascending order by columns to obtain a target two-dimensional key matrix; Constructing a position matrix according to the original position of each element in the target two-dimensional key matrix; Rearranging the image block matrix according to the position matrix to obtain a rearranged image block matrix; The position scrambled blocks of the single channel are determined according to the rearranged image block matrix.
[0011] In one embodiment, the step of performing bidirectional diffusion encryption on the second target image block to obtain a target encrypted image block includes: generating a first key stream; Based on the first key stream, forward diffusion is performed on the second target image block of each single channel by using an exclusive OR operation to obtain an initial encrypted image block of each single channel; generating a second key stream; Based on the second key stream, an XOR operation is used to perform reverse diffusion on the initial encrypted image block of each single channel to obtain the target encrypted image block of each single channel.
[0012] In one embodiment, the step of integrating the target encrypted image into blocks to obtain the target encrypted image includes: The target encrypted image of each single channel is combined into blocks to obtain the encrypted image of each single channel; Merge each single-channel encrypted image channel to obtain the target encrypted image.
[0013] In a second aspect, the present disclosure further provides an image encryption device, comprising: A segmentation module, configured to segment the Internet of Vehicles image based on real-time transmission performance requirement information of the Internet of Vehicles image in the Internet of Vehicles to obtain a first target image block; A scrambling module, used for scrambling the first target image blocks to obtain second target image blocks; An encryption module, used for performing bidirectional diffusion encryption on the second target image block to obtain a target encrypted image block; The integration module is used to integrate the target encrypted image into blocks to obtain the target encrypted image.
[0014] In a third aspect, the present disclosure provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of any of the above-mentioned image encryption methods are implemented.
[0015] In a fourth aspect, the present disclosure also provides a non-transitory computer-readable storage medium, which includes a non-transitory computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the steps of any of the above-mentioned image encryption methods are implemented.
[0016] In a fifth aspect, the present disclosure also provides a computer program product, which includes a computer program. The computer program can be stored on a non-transitory computer-readable storage medium, and when the computer program is executed by the processor, it implements the steps of any of the above-mentioned image encryption methods.
[0017] The image encryption method, device, electronic device, storage medium and program product provided by the present invention divide the Internet of Vehicles image into multiple small-sized sub-blocks according to the real-time requirements and data transmission characteristics in the current Internet of Vehicles environment, first scramble the sub-blocks, and then independently encrypt each sub-block. Even if part of the key is cracked, only part of the image can be accessed and the entire image cannot be restored, thereby reducing the risk of global key leakage. In addition, the encryption process is optimized to adapt to the Internet of Vehicles environment, the encryption processing time is reduced, and the real-time and security requirements of the Internet of Vehicles can be met at the same time, ensuring the efficient and secure transmission of the target encrypted image in the Internet of Vehicles. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the technical solutions in the present disclosure or the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0019] Figure 1 It is one of the flowcharts of the image encryption method provided by the present invention.
[0020] Figure 2 This is the second flowchart of the image encryption method provided by the present invention.
[0021] Figure 3 It is a block diagram provided by the present disclosure.
[0022] Figure 4 Schematic diagram of the pixel scrambling process provided by the present disclosure.
[0023] Figure 5 It is a schematic diagram of the structure of the image encryption device provided by the present invention.
[0024] Figure 6 It is a schematic diagram of the structure of an electronic device provided by the present disclosure. DETAILED DESCRIPTION
[0025] In order to make the purpose, technical solutions and advantages of the present disclosure clearer, the technical solutions in the present disclosure will be clearly and completely described below in conjunction with the drawings in the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, rather than all the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present disclosure.
[0026] The terms "first", "second", etc. in the present disclosure are used to distinguish similar objects, rather than to describe a specific order or precedence. It should be understood that the terms used in this manner can be interchanged where appropriate, so that the embodiments of the present disclosure can be implemented in an order other than those illustrated or described herein.
[0027] Combine the following Figure 1-Figure 6 The present invention describes an image encryption method, device, electronic device, storage medium, and program product provided by the present invention.
[0028] It should be noted that the image encryption method provided in the embodiment of the present disclosure is implemented based on the image encryption device. The image encryption method provided in the embodiment of the present disclosure, combined with the real-time requirements of the Internet of Vehicles, segments the Internet of Vehicles image into multiple blocks of appropriate sizes, and then scrambles the blocks, and then performs bidirectional diffusion encryption on the scrambled blocks to achieve encryption of independent blocks, optimize the encryption process, and finally integrate the encrypted blocks to form a secure ciphertext image. This method aims to solve the application limitations of the existing technology in the Internet of Vehicles environment and improve the real-time, security and reliability of image transmission.
[0029] The disclosed embodiment describes the image encryption method by taking an image encryption device as an execution subject as an example.
[0030] Combination Figure 1 , Figure 1 It is one of the flowcharts of the image encryption method provided by the present invention.
[0031] like Figure 1 As shown, the method includes the following: Step 101: segmenting the Internet of Vehicles image based on real-time transmission performance requirement information of the Internet of Vehicles image in the Internet of Vehicles to obtain first target image blocks; Step 104, scrambling the first target image blocks to obtain second target image blocks; Step 105, performing bidirectional diffusion encryption on the second target image block to obtain a target encrypted image block; Step 106: Integrate the target encrypted image into blocks to obtain a target encrypted image.
[0032] When the vehicle is driving, the Internet of Vehicles system can obtain Internet of Vehicles images in real time. The information in the Internet of Vehicles images may include vehicle location, road condition monitoring, driver privacy, etc. These are confidential images. Therefore, before transmitting the Internet of Vehicles images, they need to be encrypted first to prevent unauthorized access and interpretation.
[0033] Specifically, a vehicle network image may be obtained, and multiple vehicle network images may be obtained. Here, a vehicle network image is obtained for description.
[0034] After acquiring the Internet of Vehicles image, image preprocessing is required so that the image can be better encrypted and processed to reduce the processing difficulty. At the same time, the encryption processing method can be compatible with general compression standards such as JPEG to ensure that the encrypted image does not lose quality during compression and transmission. It is suitable for specific scenarios where Internet of Vehicles requires efficient transmission.
[0035] The image preprocessing process includes but is not limited to the following steps: (1) Format standardization: Determine the IoV image to be encrypted and adjust its pixel size to a size that complies with the IoV data transmission standard to ensure the compatibility of the image between different devices and networks; (2) Noise removal: Use filtering technology to remove noise from the Internet of Vehicles image to improve the quality of the encrypted image; (3) Data normalization: Normalize the pixel values of the Internet of Vehicles image to make the pixel value distribution more uniform.
[0036] Furthermore, the Internet of Vehicles images, network status information, vehicle location information and vehicle driving data in the Internet of Vehicles are obtained, and real-time demand analysis is performed through these Internet of Vehicles data to obtain the real-time demand of the vehicle network.
[0037] Furthermore, according to the real-time requirements of the vehicle network, the real-time transmission performance requirement information of the vehicle network image in the vehicle network is determined.
[0038] Furthermore, based on the real-time transmission performance requirement information of the Internet of Vehicles image in the Internet of Vehicles, the Internet of Vehicles image is segmented to obtain at least one first target image block. The present invention is not specifically limited to this. It can be considered that when the real-time transmission performance requirement is higher, the Internet of Vehicles image is segmented into larger blocks, and the encryption processing speed is faster. When the real-time transmission performance requirement is lower, the Internet of Vehicles image is segmented into smaller blocks, and the encryption processing speed is slower.
[0039] Furthermore, the first target image blocks are first positionally scrambled, and then pixel values are scrambled on the positionally scrambled blocks, to obtain the second target image blocks with scrambled positions and scrambled pixel values.
[0040] Furthermore, the second target image block is firstly forward diffused and encrypted, and then the pixel value of the forward diffused and encrypted block is reverse diffused and encrypted to obtain the target encrypted image block after bidirectional diffusion encryption.
[0041] Furthermore, the target encrypted image is obtained by integrating the blocks based on the target encrypted image.
[0042] The image encryption method provided by the present invention divides the Internet of Vehicles image into multiple small-sized sub-blocks according to the real-time requirements and data transmission characteristics in the current Internet of Vehicles environment, first scrambles the sub-blocks, and then independently encrypts each sub-block. Even if part of the key is cracked, only part of the image can be accessed, and the entire image cannot be restored, thereby reducing the risk of global key leakage. In addition, the encryption process is optimized while adapting to the Internet of Vehicles environment, the encryption processing time is reduced, and the real-time and security requirements of the Internet of Vehicles can be met at the same time, ensuring the efficient and secure transmission of the target encrypted image in the Internet of Vehicles.
[0043] In some embodiments, based on step 102, the real-time transmission performance requirement information of the connected vehicle image in the connected vehicle is determined by: Acquiring at least one of network status information, vehicle location information, and vehicle driving data; Performing a real-time demand analysis based on at least one of the network status information, the vehicle location information, and the vehicle driving data to obtain the real-time demand for image data transmission of the Internet of Vehicles; According to the real-time requirement, real-time transmission performance requirement information of the connected vehicle image in the connected vehicle is determined.
[0044] Specifically, the network status information, vehicle location information and vehicle driving data in the Internet of Vehicles are obtained, wherein the network status information includes but is not limited to bandwidth information and delay information, the vehicle location information is collected by the global positioning system configured on the vehicle, and the vehicle driving data is obtained by the vehicle speed sensor configured on the vehicle.
[0045] Furthermore, a real-time demand analysis is performed based on network status information, vehicle location information, and vehicle driving data in the Internet of Vehicles to obtain the real-time demand of the Internet of Vehicles.
[0046] Furthermore, according to the real-time requirements of the Internet of Vehicles, the real-time transmission performance requirement information of the Internet of Vehicles images in the Internet of Vehicles is determined. Among them, the real-time transmission performance requirement information of the Internet of Vehicles images in the Internet of Vehicles can be determined by the maximum allowable transmission delay, minimum transmission rate and other data of the Internet of Vehicles images transmitted in the Internet of Vehicles. The maximum allowable transmission delay refers to the maximum time interval that the Internet of Vehicles system can tolerate in the process of data from the sender to the receiver, and the minimum transmission rate refers to the minimum data transmission speed that the Internet of Vehicles system needs to maintain in order to meet the real-time requirements. The smaller the maximum allowable transmission delay and the larger the minimum transmission rate, the higher the real-time transmission performance requirement information of the Internet of Vehicles; the larger the maximum allowable transmission delay and the smaller the minimum transmission rate, the lower the real-time transmission performance requirement information of the Internet of Vehicles.
[0047] The disclosed embodiment parses the real-time requirements of the Internet of Vehicles based on real-time Internet of Vehicles data, determines the real-time transmission performance requirement information of the Internet of Vehicles image in the Internet of Vehicles based on the real-time requirements, and then realizes the real-time requirements of the Internet of Vehicles environment. The strategy of image segmentation and independent encryption is adopted to divide the Internet of Vehicles image into multiple small-sized blocks and encrypt them separately. This can not only reduce the time delay of encryption processing and meet the real-time requirements and data transmission characteristics in the Internet of Vehicles environment, but also improve the flexibility and security of encryption and prevent the leakage of global keys.
[0048] In some embodiments, based on step 103, segmenting the Internet of Vehicles image based on the real-time transmission performance requirement information of the Internet of Vehicles image in the Internet of Vehicles to obtain the first target image block includes: Performing three-channel RGB decomposition on the Internet of Vehicles image to obtain three single-channel image data; According to the real-time transmission performance requirement information, the image data of each single channel is segmented to obtain the first target image block of each single channel.
[0049] Specifically, according to the size of the Internet of Vehicles image and the real-time transmission performance requirement information of the Internet of Vehicles image in the Internet of Vehicles, the Internet of Vehicles image is decomposed into three channels of RGB, that is, the red (RED), green (Green) and blue (Blue) of the Internet of Vehicles image are separated according to the color channels to obtain three single-channel image data, which can be processed independently.
[0050] Furthermore, according to the real-time transmission performance requirement information of the vehicle network in the Internet of Vehicles, the image data of each single channel is segmented to obtain multiple first target image blocks for each single channel. It can be understood that when the real-time transmission performance requirement is higher, the Internet of Vehicles image is segmented into larger blocks, so that the subsequent encryption processing speed is faster; when the real-time transmission performance requirement is lower, the Internet of Vehicles image is segmented into smaller blocks, so that the subsequent encryption processing speed is slower.
[0051] In one embodiment, when the maximum allowable transmission delay in the Internet of Vehicles is 100ms and the transmission rate is 1.25MBps, the image block size needs to be less than 125KB. If the original image size is 6MB, it needs to be divided into 48 blocks (6MB / 125KB=48); when the minimum transmission rate in the Internet of Vehicles is 0.125MBps and the image transmission time is 20ms, the image block size needs to be less than 2.5MB. If the original image size is 5MB, it needs to be divided into 2 blocks.
[0052] The disclosed embodiment first decomposes a color image into image data of three channels, R, G, and B, and processes the image data of a single channel independently, so that the image processing is more refined and accurate. Furthermore, in combination with the real-time requirements of the Internet of Vehicles, the image data of each single channel is divided into blocks of appropriate sizes and encrypted separately. This not only reduces the time delay of the encryption processing and meets the real-time requirements and data transmission characteristics in the Internet of Vehicles environment, but also improves the flexibility and security of encryption and prevents the leakage of global keys.
[0053] In some embodiments, scrambling the first target image blocks to obtain second target image blocks includes: generating a first key; Based on the first key, position scrambling is performed on the first target image block of each single channel to obtain the position scrambled block of each single channel; generating a second key; Based on the second key, pixel values of the position scrambled blocks of each single channel are scrambled to obtain the second target image blocks of each single channel.
[0054] Specifically, the SHA-256 secure hash algorithm is used, but is not limited to this hash algorithm, to generate a random integer as the first key.
[0055] Furthermore, based on the first key, the first target image block of each single channel is positionally scrambled to obtain a plurality of positionally scrambled blocks of each single channel.
[0056] Furthermore, a random integer is generated as the second key using the SHA-256 secure hash algorithm, but is certainly not limited to this hash algorithm.
[0057] Furthermore, based on the second key, pixel values of the position scrambled blocks of each single channel are scrambled respectively to obtain a plurality of second target image blocks of each single channel.
[0058] It should be noted that, unlike traditional static keys, the key generation involved in the present disclosure is dynamic, and different keys will be regenerated according to different scrambling requirements, just like the first key and the second key mentioned above, which are different. The first key is used for position scrambling of blocks, and the second key is used for pixel value scrambling of pixel values in blocks. This dynamic key generation mechanism ensures that different keys are used for each encryption, which greatly increases the complexity and randomness of the key, thereby improving the security and flexibility of encryption and enhancing the defense capability of the encryption system.
[0059] The disclosed embodiment utilizes a hash algorithm to generate a high-strength random key, first scrambles the positions of the blocks, then scrambles the pixel values in the blocks, and further independently encrypts the blocks under double scrambling. Through complex mathematical operations, the defense capability of the encryption system is enhanced to effectively resist various attacks on image data in the Internet of Vehicles environment.
[0060] According to the above content, the first target image block of each single channel is positionally scrambled based on the first key to obtain the position scrambled block of each single channel, including: Converting the single-channel first target image blocks into an image block matrix; Converting the first key into an initial two-dimensional key matrix; The elements in the initial two-dimensional key matrix are sorted in ascending order by columns to obtain a target two-dimensional key matrix; Constructing a position matrix according to the original position of each element in the target two-dimensional key matrix; Rearranging the image block matrix according to the position matrix to obtain a rearranged image block matrix; The position scrambled blocks of the single channel are determined according to the rearranged image block matrix.
[0061] Specifically, the single-channel first target image is converted into an image block matrix, and the first key is converted into an initial two-dimensional key matrix.
[0062] Furthermore, the elements in the initial two-dimensional key matrix are sorted in ascending order by column, that is, the elements in each column of the initial two-dimensional key matrix are sorted in ascending order according to numerical value, and the target two-dimensional key matrix is constructed according to the re-sorted elements.
[0063] Furthermore, the original position of each element in the target two-dimensional key matrix is determined, and the original position of each element is recorded on the position matrix in the order of the current position of each element in the target two-dimensional key matrix to obtain the assigned position matrix.
[0064] Furthermore, the image block matrix is rearranged according to the position matrix. It can be understood that according to the way in which the original positions of the elements in the two-dimensional key matrix are migrated to the current positions, the image block matrix is rearranged in the same position migration manner to obtain the arranged image block matrix.
[0065] Therefore, the position scrambled blocks of a single channel can be determined according to the arranged image block matrix.
[0066] Similarly, according to the above content, based on the second key, the pixel value of each single-channel position scrambled block is scrambled to obtain the second target image block of each single channel, including: Converting a plurality of pixel values included in the position scrambled block of the single channel into a pixel value matrix; Converting the second key into an initial two-dimensional key matrix; The elements in the initial two-dimensional key matrix are sorted in ascending order by columns to obtain a target two-dimensional key matrix; Constructing a position matrix according to the original position of each element in the target two-dimensional key matrix; Rearranging the pixel value matrix according to the position matrix to obtain an arranged pixel value matrix; The second target image block of the single channel is determined according to the arranged pixel value matrix.
[0067] It should be noted that the specific process of pixel value scrambling is consistent with the above-mentioned position scrambling process, which will not be described in detail here.
[0068] The disclosed embodiment utilizes a hash algorithm to generate a high-strength random key, first scrambles the positions of the blocks, then scrambles the pixel values in the blocks, and further independently encrypts the blocks under double scrambling. Through complex mathematical operations, the defense capability of the encryption system is enhanced to effectively resist various attacks on image data in the Internet of Vehicles environment.
[0069] In some embodiments, based on step 105, the step of performing bidirectional diffusion encryption on the second target image block to obtain a target encrypted image block includes: generating a first key stream; Based on the first key stream, forward diffusion is performed on the second target image block of each single channel by using an exclusive OR operation to obtain an initial encrypted image block of each single channel; generating a second key stream; Based on the second key stream, an XOR operation is used to perform reverse diffusion on the initial encrypted image block of each single channel to obtain the target encrypted image block of each single channel.
[0070] Specifically, a chaotic system is used to generate a first key stream with high complexity.
[0071] Furthermore, based on the first key stream, an XOR operation is used to perform forward diffusion on the second target image block of each single channel to obtain an initial encrypted image block of each single channel.
[0072] It can be understood that the first chaotic series of a preset length is obtained by using the chaotic system , the process is as follows: in, Representation sequence Middlei elements, Representation sequence Middle i +1 element; Represents system parameters, , the system is in a chaotic state.
[0073] For chaotic sequences Quantize and generate the first key stream , the process is as follows: in, represents the first chaotic series; Used for rounding down; Represents the modulo operation.
[0074] The XOR operation is used to perform forward diffusion on the second target image blocks of a single channel, and the process is as follows: in, After forward diffusion i The value of the pixel value element, After forward diffusion i -1 pixel value element value, Represents the first key stream The i elements, Represents the single-channel image data i A second target image block.
[0075] Furthermore, a chaotic system is used to generate a second key stream with high complexity.
[0076] Furthermore, an XOR operation is used to perform reverse diffusion on the initial encrypted image block of each single channel based on the second key stream to obtain a target encrypted image block of each single channel.
[0077] It can be understood that the second chaotic series of a preset length is obtained by using the chaotic system , the process is as follows: in, Representation sequence Middle i elements, Representation sequence Middle i +1 element; Represents system parameters, , the system is in a chaotic state.
[0078] For chaotic sequences Quantize and generate the second key stream , the process is as follows: in, represents the second chaotic series; Used for rounding down; Represents the modulo operation.
[0079] The XOR operation is used to perform reverse diffusion of pixel values on the blocks of the initial encrypted image of a single channel. The process is as follows: in, Represents the reverse diffusion i The value of the pixel value element, Represents the reverse diffusion i+ The value of a pixel value element, Represents the second key stream The i elements, After forward diffusion i The value of the pixel value element.
[0080] It should be noted that, unlike the traditional static key stream, the key stream generation involved in the present disclosure is dynamic, and different key streams will be regenerated according to different diffusion encryption processes, just like the first key stream and the second key stream mentioned above, which are different. The first key stream is used for forward diffusion of blocks, and the second key stream is used for reverse diffusion of pixel values in blocks. This dynamic key stream generation mechanism ensures that a different key stream is used for each encryption, which greatly increases the complexity and randomness of the key stream, thereby improving the security and flexibility of encryption and enhancing the defense capability of the encryption system.
[0081] After implementing double-reset scrambling, the disclosed embodiment adopts a bidirectional diffusion encryption strategy for the scrambled blocks, performs two rounds of diffusion operations on the image pixel values in different directions, fully confuses the Internet of Vehicles image information, increases the difficulty for attackers to parse the encrypted image, significantly improves the encryption difficulty, and thus improves the flexibility and security of encryption.
[0082] In some embodiments, based on step 106, the step of integrating the target encrypted image into blocks to obtain the target encrypted image includes: The target encrypted image of each single channel is combined into blocks to obtain the encrypted image of each single channel; Merge each single-channel encrypted image channel to obtain the target encrypted image.
[0083] Specifically, each single-channel target encrypted image is combined in blocks to obtain each single-channel encrypted image, and further, each single-channel encrypted image is channel-merged to obtain the target encrypted image.
[0084] The disclosed embodiment combines the refined encrypted target encrypted image blocks, and then merges the channels to obtain a final complete target encrypted image, thereby improving the real-time, security and reliability of image transmission in a connected vehicle environment.
[0085] Combination Figure 2 , Figure 2 This is the second flow chart of the image encryption method provided by the present disclosure. Figure 2 The following is an example of the above-described process.
[0086] Step 1: Determine the Internet of Vehicles image to be encrypted, perform image preprocessing, and define its pixel size as .
[0087] Step 2: Analyze the real-time transmission performance requirement information of the Internet of Vehicles image in the Internet of Vehicles. According to the real-time transmission performance requirement information, the Internet of Vehicles image is decomposed into three component channels of R, G, and B to obtain image data.
[0088] Step 3: Divide the single-channel image data into The sub-blocks, such as Figure 3 As shown, Figure 3 It is a block diagram provided by the present disclosure.
[0089] In order to ensure that the segmentation process can completely cover the pixels in all areas of the image, define: Generally speaking, multiple blocks of the same size are generated during the segmentation process, but blocks of the same size may not be generated at the edge. Therefore, the above definition is required to achieve an accurate segmentation process.
[0090] Step 4: Create a random integer as the first key using the secure hash algorithm (SHA-256) , using the first key , re-arrange the order of the blocks generated in step 3 to disrupt the positions of the blocks in the original image.
[0091] Step 5: Create a random integer as the second key using the secure hash algorithm (SHA-256) , using the second key The pixel values of each block are scrambled. The specific process is as follows: Figure 4 As shown, Figure 4 is a schematic diagram of the pixel scrambling process provided by the present disclosure. First, the second key Convert it into the initial two-dimensional key matrix CS, sort the elements in CS in ascending order by column, and obtain the sorted target two-dimensional key matrix SCS. Further, record the original positions of the elements in SCS in the position matrix ICS, and rearrange the plaintext pixel value matrix according to the position matrix ICS to complete the pixel value scrambling transformation.
[0092] Step 6: (1) Generate the first key stream: Obtain a length of Chaotic sequence , the process is as follows: in, Representation sequence Middle i elements, Representation sequence Middle i +1 element; Represents system parameters, , the system is in a chaotic state.
[0093] For chaotic sequences Quantize and generate the first key stream , the process is as follows: in, represents the first chaotic series; Used for rounding down; Represents the modulo operation.
[0094] (2) Perform a round of forward diffusion: Use XOR operation to perform forward diffusion on multiple scrambled blocks generated in step 5. The process is as follows: in, , After forward diffusion i The value of the pixel value element, After forward diffusion i -1 pixel value element value, Represents the first key stream The i elements, Represents the single-channel image data i Blocks.
[0095] Step 7: (1) Generate the second key stream: Obtain the length of Chaotic sequence , the process is as follows: in, Representation sequence Middle i elements, Representation sequence Middle i +1 element; Represents system parameters, , the system is in a chaotic state.
[0096] For chaotic sequences Quantize and generate key stream , the process is as follows: in, represents the second chaotic series; Used for rounding down; Represents the modulo operation.
[0097] (2) Perform two rounds of reverse diffusion: perform reverse diffusion on each element of the block after forward diffusion. The process is as follows: in, Represents the reverse diffusion i The value of the pixel value element, Represents the reverse diffusion i+ The value of a pixel value element, Represents the second key stream The i elements, After forward diffusion i The value of the pixel value element.
[0098] Step 8: Integrate the blocks after bidirectional diffusion encryption and merge the channels to form a secure target encrypted image.
[0099] The image encryption method provided not only has significant advantages in the current environment, but also its security and flexibility will be further verified and improved with the development of technology and the deepening of application, providing a strong guarantee for long-term application. In addition, the technical framework and algorithm design of this method have good scalability and can be further optimized and upgraded according to the development of future technology and application needs.
[0100] The image encryption device provided by the present disclosure is described below. The image encryption device described below and the image encryption method described above can be referenced to each other.
[0101] Reference Figure 5 , Figure 5 It is a schematic diagram of the structure of the image encryption device provided by the present invention.
[0102] The image encryption device comprises: The segmentation module 510 is used to segment the Internet of Vehicles image based on the real-time transmission performance requirement information of the Internet of Vehicles image in the Internet of Vehicles to obtain the first target image block.
[0103] The scrambling module 520 is used to scramble the first target image blocks to obtain second target image blocks.
[0104] The encryption module 530 is used to perform bidirectional diffusion encryption on the second target image block to obtain a target encrypted image block.
[0105] The integration module 540 is used to integrate the target encrypted image into blocks to obtain a target encrypted image.
[0106] The image encryption device provided by the present invention divides the Internet of Vehicles image into multiple small-sized sub-blocks according to the real-time requirements and data transmission characteristics in the current Internet of Vehicles environment, first scrambles the sub-blocks, and then independently encrypts each sub-block. Even if part of the key is cracked, only part of the image can be accessed, and the entire image cannot be restored, thereby reducing the risk of global key leakage. In addition, the encryption process is optimized to adapt to the Internet of Vehicles environment, the encryption processing time is reduced, and the real-time and security requirements of the Internet of Vehicles can be met at the same time, ensuring the efficient and secure transmission of the target encrypted image in the Internet of Vehicles.
[0107] Furthermore, the image encryption device is also used for: Acquiring at least one of network status information, vehicle location information, and vehicle driving data; Performing a real-time demand analysis based on at least one of the network status information, the vehicle location information, and the vehicle driving data to obtain the real-time demand for image data transmission of the Internet of Vehicles; According to the real-time requirement, real-time transmission performance requirement information of the connected vehicle image in the connected vehicle is determined.
[0108] Furthermore, the segmentation module 510 is also used for: Performing three-channel RGB decomposition on the Internet of Vehicles image to obtain three single-channel image data; According to the real-time transmission performance requirement information, the image data of each single channel is segmented to obtain the first target image block of each single channel.
[0109] Furthermore, the scrambling module 520 is also used for: generating a first key; Based on the first key, position scrambling is performed on the first target image block of each single channel to obtain the position scrambled block of each single channel; generating a second key; Based on the second key, pixel values of the position scrambled blocks of each single channel are scrambled to obtain the second target image blocks of each single channel.
[0110] Furthermore, the scrambling module 520 is also used for: Converting the single-channel first target image blocks into an image block matrix; Converting the first key into an initial two-dimensional key matrix; The elements in the initial two-dimensional key matrix are sorted in ascending order by columns to obtain a target two-dimensional key matrix; Constructing a position matrix according to the original position of each element in the target two-dimensional key matrix; Rearranging the image block matrix according to the position matrix to obtain a rearranged image block matrix; The position scrambled blocks of the single channel are determined according to the rearranged image block matrix.
[0111] Furthermore, the encryption module 530 is also used for: generating a first key stream; Based on the first key stream, forward diffusion is performed on the second target image block of each single channel by using an exclusive OR operation to obtain an initial encrypted image block of each single channel; generating a second key stream; Based on the second key stream, an XOR operation is used to perform reverse diffusion on the initial encrypted image block of each single channel to obtain the target encrypted image block of each single channel.
[0112] Furthermore, the integration module 540 is also used for: The target encrypted image of each single channel is combined into blocks to obtain the encrypted image of each single channel; Merge each single-channel encrypted image channel to obtain the target encrypted image.
[0113] It should be noted that the image encryption device provided by the present disclosure can execute the image encryption method described in any of the above embodiments during specific operation, which will not be elaborated in this embodiment.
[0114] Figure 6 is a schematic diagram of the structure of the electronic device provided by the present disclosure, such as Figure 6As shown, the electronic device may include: a processor 610, a communication interface 620, a memory 630 and a communication bus 640, wherein the processor 610, the communication interface 620 and the memory 630 communicate with each other through the communication bus 640. The processor 610 may call the logic instructions in the memory 630 to execute the image encryption method, which includes: based on the real-time transmission performance requirement information of the Internet of Vehicles image in the Internet of Vehicles, segmenting the Internet of Vehicles image to obtain a first target image block; scrambling the first target image block to obtain a second target image block; bidirectionally diffusing and encrypting the second target image block to obtain a target encrypted image block; integrating the target encrypted image blocks to obtain a target encrypted image.
[0115] In addition, the logic instructions in the above-mentioned memory 630 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on this understanding, the technical solution of the present disclosure, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present disclosure. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.
[0116] On the other hand, the present disclosure also provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute the image encryption method provided by the above-mentioned embodiments, and the method includes: based on the real-time transmission performance requirement information of the Internet of Vehicles image in the Internet of Vehicles, segmenting the Internet of Vehicles image to obtain a first target image block; scrambling the first target image block to obtain a second target image block; bidirectionally diffusing the second target image block to obtain a target encrypted image block; integrating the target encrypted image blocks to obtain a target encrypted image.
[0117] On the other hand, the present disclosure also provides a non-transitory computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, it is implemented to execute the image encryption method provided by the above-mentioned embodiments, the method comprising: based on the real-time transmission performance requirement information of the Internet of Vehicles image in the Internet of Vehicles, segmenting the Internet of Vehicles image to obtain a first target image block; scrambling the first target image block to obtain a second target image block; bidirectionally diffusion encrypting the second target image block to obtain a target encrypted image block; integrating the target encrypted image blocks to obtain a target encrypted image.
[0118] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment. Those of ordinary skill in the art may understand and implement the present invention without creative effort.
[0119] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0120] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present disclosure, rather than to limit them. Although the present disclosure has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present disclosure.
Claims
1. An image encryption method, characterized in that: include: Based on the real-time transmission performance requirement information of the Internet of Vehicles image in the Internet of Vehicles, segmenting the Internet of Vehicles image to obtain a first target image block; Scrambling the first target image blocks to obtain second target image blocks; Performing bidirectional diffusion encryption on the second target image block to obtain a target encrypted image block; The target encrypted image is divided into blocks and integrated to obtain a target encrypted image.
2. The image encryption method according to claim 1, characterized in that: The real-time transmission performance requirement information of the Internet of Vehicles image in the Internet of Vehicles is determined in the following manner: Acquiring at least one of network status information, vehicle location information, and vehicle driving data; Performing a real-time demand analysis based on at least one of the network status information, the vehicle location information, and the vehicle driving data to obtain the real-time demand for image data transmission of the Internet of Vehicles; According to the real-time requirement, real-time transmission performance requirement information of the connected vehicle image in the connected vehicle is determined.
3. The image encryption method according to claim 1 or 2, characterized in that: The step of segmenting the Internet of Vehicles image based on the real-time transmission performance requirement information of the Internet of Vehicles image in the Internet of Vehicles to obtain the first target image blocks includes: Performing three-channel RGB decomposition on the Internet of Vehicles image to obtain three single-channel image data; According to the real-time transmission performance requirement information, the image data of each single channel is segmented to obtain the first target image block of each single channel.
4. The image encryption method according to claim 3, characterized in that: The step of scrambling the first target image blocks to obtain second target image blocks includes: generating a first key; Based on the first key, position scrambling is performed on the first target image block of each single channel to obtain the position scrambled block of each single channel; generating a second key; Based on the second key, pixel values of the position scrambled blocks of each single channel are scrambled to obtain the second target image blocks of each single channel.
5. The image encryption method according to claim 4, characterized in that: The step of performing position scrambling on the first target image block of each single channel based on the first key to obtain the position scrambled block of each single channel includes: Converting the single-channel first target image blocks into an image block matrix; Converting the first key into an initial two-dimensional key matrix; The elements in the initial two-dimensional key matrix are sorted in ascending order by columns to obtain a target two-dimensional key matrix; Constructing a position matrix according to the original position of each element in the target two-dimensional key matrix; Rearranging the image block matrix according to the position matrix to obtain a rearranged image block matrix; The position scrambled blocks of the single channel are determined according to the rearranged image block matrix.
6. The image encryption method according to claim 4 or 5, characterized in that: The step of performing bidirectional diffusion encryption on the second target image block to obtain a target encrypted image block includes: generating a first key stream; Based on the first key stream, forward diffusion is performed on the second target image block of each single channel by using an exclusive OR operation to obtain an initial encrypted image block of each single channel; generating a second key stream; Based on the second key stream, an XOR operation is used to perform reverse diffusion on the initial encrypted image block of each single channel to obtain the target encrypted image block of each single channel.
7. The image encryption method according to claim 6, characterized in that: The step of integrating the target encrypted image into blocks to obtain the target encrypted image includes: The target encrypted image of each single channel is combined into blocks to obtain the encrypted image of each single channel; Merge each single-channel encrypted image channel to obtain the target encrypted image.
8. An image encryption device, characterized in that: include: A segmentation module, configured to segment the Internet of Vehicles image based on real-time transmission performance requirement information of the Internet of Vehicles image in the Internet of Vehicles to obtain a first target image block; A scrambling module, used for scrambling the first target image blocks to obtain second target image blocks; An encryption module, used for performing bidirectional diffusion encryption on the second target image block to obtain a target encrypted image block; The integration module is used to integrate the target encrypted image into blocks to obtain the target encrypted image.
9. An electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the steps of the image encryption method according to any one of claims 1 to 7 are implemented.
10. A non-transitory computer-readable storage medium, the non-transitory computer-readable storage medium comprising a non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the image encryption method according to any one of claims 1 to 7 are implemented.
11. A computer program product, comprising a computer program, characterized in that: When the computer program is executed by a processor, the steps of the image encryption method according to any one of claims 1 to 7 are implemented.