Video information encryption method and device, electronic equipment and storage medium
By mutation and plane reorganization of the bit surface of the video frame, the problem of easy leakage of video information encryption in the prior art is solved, and efficient encryption and confidentiality of video information are achieved.
Patent Information
- Application Number
- CN202411503625.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-25
- Publication Date
- 2025-02-11
AI Technical Summary
In the prior art, video information encryption methods can easily lead to video information leakage, and third-party attacks can decrypt the cipher text after obtaining the key.
By obtaining the bit plane corresponding to the video frame of the video to be encrypted, the target mutation rules are determined based on the bit value count in each bit plane, the bit plane is mutation operation, and plane recombination is performed to obtain the mutationed pixel matrix.
Effectively hide video information and enhance video confidentiality. Even if the video is leaked, it cannot be deciphered in reverse through the encrypted video.
Smart Images

Figure CN119420968A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of security enhancement technology, and in particular to a method and device for encrypting video information, an electronic device, and a storage medium. Background Art
[0002] The rapid development of cloud computing has brought great convenience to the work and study of enterprises and individuals. Cloud service providers provide them with convenient computing, storage and other resources. However, due to the deficiencies of Internet technology in various aspects, tenant information is repeatedly processed and processed during network transmission, which is inevitably obtained by third parties maliciously and profited from. Therefore, the gradual emergence of information leakage and information forgery has caused losses of varying degrees, making tenants pay more and more attention to information security issues.
[0003] Among various information dissemination carriers such as text, images, and videos, videos are frequently used by users due to their intuitive expression, rich information, and strong interactivity, and are gradually becoming the mainstream transmission object. At present, as users pay more attention to personal privacy and security, real-time video information masking has become an obvious need for users when using the Internet.
[0004] At present, the encryption of video information usually uses a random sequence obtained by a chaotic algorithm to directly replace the fixed parameters in the source SM4, and uses the SM2 algorithm to asymmetrically encrypt the random parameters as key parameters and transmit them together with the ciphertext. Although this method can encrypt video information to a certain extent, after a third party attacks and obtains the parameter key, the ciphertext can be decrypted, resulting in the leakage of encrypted video information. Summary of the invention
[0005] The present invention provides a method, device, electronic device and storage medium for encrypting video information, and its main purpose is to solve the problem that video information leakage is easy to cause in the prior art.
[0006] According to a first aspect of the present disclosure, a method for encrypting video information is provided, comprising:
[0007] Obtaining a bit plane corresponding to a video frame of a video to be encrypted;
[0008] Determine a target mutation rule for each bit plane according to the bit value count in each bit plane, and perform a mutation operation on each bit plane according to the target mutation rule;
[0009] A plane reorganization operation is performed according to the mutated bit plane to obtain the mutated pixel matrix.
[0010] Optionally, obtaining a bit plane corresponding to a video frame of the video to be encrypted includes:
[0011] Segment the video frame of the video to be encrypted into pixel rings, and combine the pixel rings obtained by segmentation based on the index array to obtain an image matrix;
[0012] The image matrix is segmented to obtain a preset number of bit planes.
[0013] Optionally, segmenting the image matrix to obtain a preset number of bit planes includes:
[0014] Get the bit value of each pixel in the image matrix;
[0015] The image matrix is divided according to the number of bits of the bit value to obtain bit planes with the same number of bits as the bit value; wherein a bit plane contains the same number of bits of bit values for each pixel.
[0016] Optionally, determining a target mutation rule for each bit plane according to the bit value count in each bit plane, and performing a mutation operation on each bit plane according to the target mutation rule includes:
[0017] Counting 0s and 1s for each bit plane to obtain a first statistical number of bit values of 0 and a second statistical number of bit values of 1 for each bit plane;
[0018] When the first statistical quantity is greater than the second statistical quantity, determining the target mutation rule is to perform an inversion operation on the bit value in the bit plane whose bit position is an even number, and adding a first preset identifier to the bit plane; wherein the preset identifier includes the mutation rule of the bit plane, different mutation rules correspond to different preset identifiers, and the preset identifier is used to decrypt the video according to the mutation rule corresponding to the preset identifier when decrypting the video;
[0019] When the first statistical number is less than the second statistical number, determining the target mutation rule is to perform a negation operation on the bit value in the bit plane with an odd bit position, and adding a second preset identifier to the bit plane;
[0020] When the first statistical quantity is equal to the second statistical quantity, it is determined that the target mutation rule is to perform an inversion operation on the bit values in all the bit planes, and to add a third preset identifier to the bit plane.
[0021] Optionally, the pixel ring segmentation of the video frame of the video to be encrypted further includes:
[0022] The video frame is scanned and segmented in parallel based on at least two threads; wherein the number of threads is determined according to the size of the video frame.
[0023] Optionally, before the video frame of the video to be encrypted is segmented into pixel rings, the method further includes:
[0024] Constructing a seed matrix based on a preset function and the hash value of the video to be encrypted;
[0025] Calculating the index value of the link matrix element according to the coordinate index of the seed matrix and the preset parameters;
[0026] Determining parameters and initial values of the chaotic system according to the index values of the link matrix elements and the random elements in the random seed matrix;
[0027] The index array is obtained according to the chaotic random sequence output by the chaotic system.
[0028] Optionally, after obtaining the index array according to the chaotic random sequence output by the chaotic system, the method further includes:
[0029] Reorganizing the index array based on a preset sorting function;
[0030] The step of combining the pixel rings obtained by segmentation based on the index array to obtain an image matrix further comprises:
[0031] The pixel rings obtained by segmentation are combined based on the reorganized index array to obtain an image matrix.
[0032] Optionally, after performing a plane reorganization operation according to the mutated bit plane to obtain the mutated pixel matrix, the method further includes:
[0033] Obtaining a first random array and a second random array output by the chaotic system;
[0034] Calculating the first row of pixels of the image matrix and the first random array to obtain a first row diffusion sequence;
[0035] Calculating the second row of pixels of the image matrix according to the first row diffusion sequence to obtain a second row diffusion sequence, and repeating the calculation steps until the calculation of each row of pixels in the pixel matrix is completed;
[0036] Calculating the first column of pixels of the image matrix after being calculated by the first random array and the second random array to obtain a first column diffusion sequence;
[0037] The second column of pixels of the image matrix is calculated according to the first column diffusion sequence to obtain a second column diffusion sequence, and the calculation steps are repeated until the calculation of each column of pixels in the pixel matrix after the first random array calculation is completed.
[0038] According to a second aspect of the present disclosure, there is provided a video information encryption device, comprising:
[0039] An acquisition unit, used for acquiring a bit plane corresponding to a video frame of a video to be encrypted;
[0040] A segmentation unit, used for segmenting the image matrix to obtain a preset number of bit planes;
[0041] A mutation unit, used to determine a target mutation rule for each bit plane according to the bit value count in each bit plane, and perform a mutation operation on each bit plane according to the target mutation rule;
[0042] The first reorganization unit is used to perform a plane reorganization operation according to the mutated bit plane to obtain the mutated pixel matrix.
[0043] Optionally, the acquisition unit further includes
[0044] The first segmentation module is used to segment the video frame of the video to be encrypted into pixel rings;
[0045] The combination module is used to combine the pixel rings obtained by segmentation based on the index array to obtain an image matrix.
[0046] Optionally, the segmentation unit includes:
[0047] An acquisition module, used to obtain the bit value of each pixel in the image matrix;
[0048] The second segmentation module is used to segment the image matrix according to the number of bits of the bit value to obtain bit planes with the same number of bits as the bit value; wherein a bit plane contains the same number of bit values of each pixel.
[0049] Optionally, the mutation unit is further used for:
[0050] Counting 0s and 1s for each bit plane to obtain a first statistical number of bit values of 0 and a second statistical number of bit values of 1 for each bit plane;
[0051] When the first statistical quantity is greater than the second statistical quantity, determining the target mutation rule is to perform an inversion operation on the bit value in the bit plane whose bit position is an even number, and adding a first preset identifier to the bit plane; wherein the preset identifier includes the mutation rule of the bit plane, different mutation rules correspond to different preset identifiers, and the preset identifier is used to decrypt the video according to the mutation rule corresponding to the preset identifier when decrypting the video;
[0052] When the first statistical number is less than the second statistical number, determining the target mutation rule is to perform a negation operation on the bit value in the bit plane with an odd bit position, and adding a second preset identifier to the bit plane;
[0053] When the first statistical quantity is equal to the second statistical quantity, it is determined that the target mutation rule is to perform an inversion operation on the bit values in all the bit planes, and to add a third preset identifier to the bit plane.
[0054] Optionally, the segmentation module is further used for:
[0055] The video frame is scanned and segmented in parallel based on at least two threads; wherein the number of threads is determined according to the size of the video frame.
[0056] Optionally, the device further comprises:
[0057] A construction unit, used for constructing a seed matrix based on a preset function and the hash value of the video to be encrypted before the segmentation module performs pixel ring segmentation on the video frame of the video to be encrypted;
[0058] A first calculation unit, used for calculating the index value of the link matrix element according to the coordinate index of the seed matrix and the preset parameters;
[0059] A determination unit, used to determine the parameters and initial values of the chaotic system according to the index values of the link matrix elements and the random elements in the random seed matrix;
[0060] An output unit is used to output a chaotic random sequence according to the chaotic system to obtain the index array.
[0061] Optionally, the device further comprises:
[0062] A second reorganization unit is used for reorganizing the index array based on a preset sorting function after the output unit outputs the chaotic random sequence according to the chaotic system to obtain the index array;
[0063] The combined module is also used for:
[0064] The pixel rings obtained by segmentation are combined based on the reorganized index array to obtain an image matrix.
[0065] Optionally, the device further comprises:
[0066] An acquisition unit is used for acquiring a first random array and a second random array output by the chaotic system after the first reorganization unit performs a plane reorganization operation according to the mutated bit plane to obtain the mutated pixel matrix;
[0067] A second calculation unit, used for calculating the first row of pixels of the image matrix and the first random array to obtain a first row diffusion sequence;
[0068] a third calculation unit, configured to calculate the second row of pixels of the image matrix according to the first row diffusion sequence to obtain a second row diffusion sequence, and repeat the calculation steps until the calculation of each row of pixels in the pixel matrix is completed;
[0069] The second calculation unit is further used to calculate the first column of pixels of the image matrix calculated by the first random array and the second random array to obtain a first column diffusion sequence;
[0070] The third calculation unit is further used to calculate the second column of pixels of the image matrix according to the first column diffusion sequence to obtain a second column diffusion sequence, and repeat the calculation steps until the calculation of each column of pixels in the pixel matrix after the first random array calculation is completed.
[0071] According to a third aspect of the present disclosure, there is provided an electronic device, including:
[0072] at least one processor; and
[0073] a memory communicatively connected to the at least one processor; wherein,
[0074] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method described in the first aspect.
[0075] According to a fourth aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to execute the method described in the first aspect.
[0076] According to a fifth aspect of the present disclosure, a computer program product is provided, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements the method as described in the first aspect above.
[0077] The encryption method, device, electronic device and storage medium of video information provided by the present disclosure mainly include: obtaining the bit plane corresponding to the video frame of the video to be encrypted; determining the target mutation rule of each bit plane respectively according to the bit value count in each bit plane, and performing mutation operation on each bit plane according to the target mutation rule; performing plane reorganization operation according to the mutated bit plane to obtain the mutated pixel matrix. Compared with the related art, the embodiment of the present application performs parallel scrambling on the global of the video frame by constructing a pixel ring, and constructs a bit mutation rule, and performs plane-level encryption on each bit plane according to the characteristics of each bit plane itself. The mutation rule does not follow the video transmission and the mutation rule is diverse. Even if the transmitted video is leaked, it cannot be reversely deciphered through the encrypted video, which effectively hides the video information and enhances the confidentiality of the video.
[0078] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present application, nor is it intended to limit the scope of the present application. Other features of the present application will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0079] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.
[0080] Figure 1 A schematic diagram of a flow chart of a method for encrypting video information provided by an embodiment of the present disclosure;
[0081] Figure 2 A schematic diagram of pixel ring segmentation provided by an embodiment of the present disclosure;
[0082] Figure 3 A schematic diagram of a flow chart of a method for encrypting video information provided by an embodiment of the present disclosure;
[0083] Figure 4 A schematic diagram of a flow chart of a method for encrypting video information provided by an embodiment of the present disclosure;
[0084] Figure 5 A schematic diagram of a bit value mutation provided by an embodiment of the present disclosure;
[0085] Figure 6 A schematic diagram of the structure of a video information encryption device provided by an embodiment of the present disclosure;
[0086] Figure 7 A schematic diagram of the structure of a video information encryption device provided by an embodiment of the present disclosure;
[0087] Figure 8 A schematic block diagram of an exemplary electronic device provided for an embodiment of the present disclosure. DETAILED DESCRIPTION
[0088] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0089] The following describes a method, device, electronic device, and storage medium for encrypting video information according to an embodiment of the present disclosure with reference to the accompanying drawings.
[0090] Figure 1 A flowchart of a method for encrypting video information provided by an embodiment of the present disclosure.
[0091] like Figure 1 As shown, the method comprises the following steps:
[0092] Step 101: Obtain a bit plane corresponding to a video frame of a video to be encrypted.
[0093] In some embodiments, video frame information of a video may be obtained according to a video decoder, and the color channel value of each pixel in the video frame may be decomposed into a binary form, and the binary value of each bit value color channel may be further decomposed into a bit plane.
[0094] Step 102: determine the target mutation rule for each bit plane according to the bit value count in each bit plane, and perform mutation operation on each bit plane according to the target mutation rule.
[0095] In some embodiments, for each bit plane, the ratio of the counts of the bit values therein, that is, the frequency of occurrence of different bit values, is calculated. Based on the frequency information of each bit plane, a target mutation rule is determined for each bit plane. When the mutation rule is configured in advance, the correspondence between the mutation rule and the bit value counts corresponding to each mutation rule is determined in advance, aiming to disrupt the original structure of the bit plane and increase the difficulty of cracking.
[0096] Step 103, performing a plane reorganization operation according to the mutated bit plane to obtain the mutated pixel matrix.
[0097] In some embodiments, a plane reorganization operation is performed based on the mutated bit plane to reorganize the scattered bit information into a unified pixel matrix. This mutated pixel matrix not only contains all the visual information of the original video frame, but also increases the confidentiality of the data through a complex encryption algorithm. The reorganized pixel matrix can be directly used in subsequent video encoding and transmission processes, ensuring the security and integrity of the video content.
[0098] The video information encryption method provided by the present disclosure mainly includes the following technical solutions: obtaining the bit plane corresponding to the video frame of the video to be encrypted; determining the target mutation rule of each bit plane respectively according to the bit value count in each bit plane, and performing mutation operation on each bit plane according to the target mutation rule; performing plane reorganization operation according to the mutated bit plane to obtain the mutated pixel matrix. Compared with the related art, the embodiment of the present application performs parallel scrambling on the global of the video frame by constructing a pixel ring, and constructs a bit mutation rule, and performs plane-level encryption on each bit plane according to the characteristics of each bit plane itself. The mutation rule does not follow the video transmission and the mutation rule is diverse. Even if the transmitted video is leaked, it cannot be reversely deciphered through the encrypted video, which effectively hides the video information and enhances the confidentiality of the video.
[0099] In some embodiments, when obtaining the bit plane in step 101, the obtaining step may be performed according to the following steps:
[0100] The video frame of the video to be encrypted is segmented into pixel rings, and the segmented pixel rings are combined based on the index array to obtain an image matrix.
[0101] See also Figure 2 , Figure 2 A schematic diagram of pixel ring segmentation provided in an embodiment of the present application; Figure 2 As shown in the figure, the video frame is segmented into a ring structure with a pixel width to obtain several pixel rings. According to a predefined index array, these segmented pixel rings are combined to form a two-dimensional image matrix. This image matrix not only retains the basic visual information of the original video frame, but also increases the complexity and randomness of the data through the reorganization of pixel rings, providing a solid foundation for the subsequent encryption steps.
[0102] The image matrix is segmented to obtain a preset number of bit planes.
[0103] In some embodiments, the preset number is determined by the bit positions of the pixel points in the image matrix. For example, if the bit positions of the pixel points in the image matrix are 8, then the preset number is 8.
[0104] In some embodiments, when segmenting the image matrix, the following steps may be performed. Figure 3 A schematic diagram of a video information encryption method provided by an embodiment of the present disclosure is shown in FIG. Figure 3 As shown, including:
[0105] Step 201, obtaining the bit value of each pixel in the image matrix.
[0106] For each pixel, its corresponding bit value is extracted. The bit value is the smallest data unit that constitutes the pixel, usually expressed in binary form. The embodiment of the present application uses the pixel bit of 8 as an example for explanation, but this narrative method is not a specific limitation on the bit.
[0107] Step 202, dividing the image matrix according to the number of bits of the bit value to obtain bit planes with the same number of bits as the bit value; wherein a bit plane contains the same number of bits of bit values for each pixel.
[0108] The image matrix is divided into bit planes with the same number of digits as the bit values. Each bit plane contains the same number of bit values from different pixels, and these bit values present an orderly arrangement structure in space. This division method not only ensures that the data in each bit plane has the same length and format, but also facilitates the subsequent independent encryption processing of each bit plane. At the same time, since each bit plane contains information from different pixels, there is a certain correlation and redundancy between them, which helps to improve the security and reliability of the encryption algorithm.
[0109] The perturbed image matrix is split into bit planes into b_p(1), b_p(2), b_p(3), ..., b_p(8), where b_p(1) contains the bit values corresponding to the first bit of all pixels, and the same applies to the other bit planes.
[0110] To clearly illustrate the relationship between bit planes and pixels, an example is given below: there are three eight-bit pixels in the image matrix, namely pixel A (10101010), pixel B (01010101) and pixel C (11110000). When the image matrix is segmented, eight bit planes are obtained, namely b_p(1), b_p(2), b_p(3), b_p(4), b_p(5), b_p(6), b_p(7) and b_p(8). Among them, b_p(1) contains the first bit of pixel A, pixel B and pixel C, which are "1" in pixel A, "0" in pixel B and "1" in pixel C respectively; b_p(2) contains the second bit of pixel A, pixel B and pixel C, which are "0" in pixel A, "1" in pixel B and "1" in pixel C respectively, and the rest of the bit planes are similar. b_p(8) contains the eighth bit of pixel A, pixel B and pixel C, which are "0" in pixel A, "1" in pixel B and "0" in pixel C respectively.
[0111] In some embodiments, different bit value counts correspond to different mutation rules. For details, please refer to Figure 4 , Figure 4 A schematic diagram of a video information encryption method provided by an embodiment of the present disclosure is shown in FIG. Figure 4 As shown, including:
[0112] Step 301: Count 0s and 1s for each bit plane to obtain a first statistical number of bit values of 0 and a second statistical number of bit values of 1 for each bit plane.
[0113] The number of 0 and 1 counts of the split bit plane are recorded as the first statistical quantity ctbpl (0) and the second statistical quantity ct bpl (1).
[0114] Step 302, when the first statistical number is greater than the second statistical number, determine that the target mutation rule is to perform a negation operation on the bit value in the bit plane where the bit position is an even number, and add a first preset identifier to the bit plane; wherein the preset identifier includes the mutation rule of the bit plane, different mutation rules correspond to different preset identifiers, and the preset identifier is used to decrypt the video according to the mutation rule corresponding to the preset identifier when decrypting the video.
[0115] When ct bpl (0)>ct bpl (1), the inversion operation is performed on {b_p(2i)|1≤i≤4}, that is, the bit planes of even numbers are inverted, such as the bit planes with the storage bits 2, 4, 6, and 8.
[0116] Step 303: When the first statistical number is less than the second statistical number, determine that the target mutation rule is to perform a negation operation on the bit value in the bit plane with an odd bit position, and add a second preset identifier to the bit plane.
[0117] When ct bpl (0) <ct bpl (1), select Rule 2 and perform a negation operation on {b_p(2i-1)|1≤i≤4}, that is, negate the odd-numbered bit planes, such as the bit planes with the stored bits 1, 3, 5, and 7.
[0118] Step 304: when the first statistical quantity is equal to the second statistical quantity, determine that the target mutation rule is to perform an inversion operation on the bit values in all bit planes, and add a third preset identifier to the bit plane.
[0119] When ct bpl (0) = ct bpl (1), select Rule 3 and perform the inversion operation on {b_p(i)|1≤i≤8}, that is, invert all bit planes.
[0120] See also Figure 5 , Figure 5 A schematic diagram of a bit value mutation provided in an embodiment of the present application is shown in FIG. Figure 5 As shown, the change of the bit value of the pixel point after mutation using this mutation rule, in the figure, Rule.1 is the mutation rule described in step 302; Rule.2 is the mutation rule described in step 303; Rule.3 is the mutation rule described in step 304.
[0121] In some embodiments, pixel ring segmentation of a video frame of the video to be encrypted further comprises the following steps:
[0122] The video frame is scanned and segmented in parallel based on at least two threads; wherein the number of threads is determined according to the size of the video frame.
[0123] The entire video frame is scanned in parallel using a multi-threaded approach, and the number of threads created each time is adjusted by the size of the video frame and the process priority.
[0124] In some embodiments, before the video frame of the video to be encrypted is segmented into pixel rings, the following steps are also included:
[0125] Constructing a seed matrix based on a preset function and the hash value of the video to be encrypted;
[0126] Calculating the index value of the link matrix element according to the coordinate index of the seed matrix and the preset parameters;
[0127] Determining parameters and initial values of the chaotic system according to the index values of the link matrix elements and the random elements in the random seed matrix;
[0128] The index array is obtained according to the chaotic random sequence output by the chaotic system.
[0129] Use the SHA-256 function to obtain the hash value of the plaintext image and construct a random seed matrix:
[0130] H=ψ(P)
[0131] Where ψ is the hash function and P is the plaintext image to be encrypted.
[0132] Get the index value of the linkage matrix element:
[0133]
[0134] Where: i, j are the coordinate indices of the random seed matrix H, respectively, and the parameters p, q are obtained by the following custom connection rules:
[0135] p=hex2dec('H(1,1)'+'H(2,2)')
[0136] q=hex2dec('H(3,3)'+'H(4,4)')
[0137] Among them: hex2dec function is the hexadecimal to decimal algorithm, + is the connection operator of matrix elements, and the values of the random seed matrix H at coordinates (i, j) and (m, n) are connected through the connection rule.
[0138] According to the output results, the elements in the random seed matrix are randomly combined to finally obtain the hexadecimal grouping Par:
[0139] Par i =hex2dec('H(i,j)'+'H(u,v)')
[0140] Constructing a new chaotic system:
[0141]
[0142] Where n is the time delay, μ∈[1,4], α is the dynamic selection coefficient, x and y are the initial values, and Par is the parameter group of the chaotic system, which is used for the dynamic selection of parameters and initial values of the chaotic system.
[0143] According to the system parameters and initial values of the chaotic system, the detailed process of obtaining the random sequence of the key required by the encryption algorithm is as follows:
[0144] Take the Par array as the parameter group and take par i 、Par j 、Par m Get the initial value x of the TLECML chaotic system i (0), system parameters μ, α, to ensure the security of key parameters, the seed matrix position is related to the image parameters.
[0145] x i (0), μ, α are input into the TLECML chaotic system. To avoid transient effects, after N0+l iterations, the chaotic random sequence S={s1,s2,s3,...,s l}.
[0146] In some embodiments, after obtaining the index array according to the chaotic random sequence output by the chaotic system, the method further includes:
[0147] Reorganizing the index array based on a preset sorting function;
[0148] The pixel rings obtained by segmentation are combined based on the reorganized index array to obtain an image matrix.
[0149] In some embodiments, before using the mutated bit plane for data transmission, the transmission image may be encrypted twice, which specifically includes the following steps: obtaining a first random array and a second random array output by the chaotic system.
[0150] Use the Sort function to obtain the index array of the chaotic sequence, which is the index array reorganized by the pixel ring; calculate the first row of pixels of the image matrix and the first random array to obtain a first row diffusion sequence; calculate the second row of pixels of the image matrix according to the first row diffusion sequence to obtain a second row diffusion sequence, and repeat the calculation steps until the calculation of each row of pixels in the pixel matrix is completed; calculate the first column of pixels of the image matrix after calculation by the first random array and the second random array to obtain a first column diffusion sequence; calculate the second column of pixels of the image matrix according to the first column diffusion sequence to obtain a second column diffusion sequence, and repeat the calculation steps until the calculation of each column of pixels in the pixel matrix after calculation by the first random array is completed.
[0151] The chaotic system obtains two random arrays D_row and D_col to complete the row-by-row and column-by-column pixel diffusion operations on the video frame BP after the bit mutation. The specific operations are as follows:
[0152] The pixels of the first row of BP are XORed bit by bit with D_row, and then the pixel sequence after diffusion of the first row is used as the input of the diffusion of the second row, and the XOR operation is performed on the next row until all rows are completed to obtain BPR; then in the same way, the random array D_col is used to perform column-by-column XOR operation on BPR to obtain the final encrypted video frame CP.
[0153] Corresponding to the above-mentioned video information encryption method, the present invention also provides a video information encryption device. Since the device embodiment of the present invention corresponds to the above-mentioned method embodiment, the details not disclosed in the device embodiment can be referred to the above-mentioned method embodiment, and will not be repeated in the present invention.
[0154] Figure 6 A schematic diagram of a video information encryption device provided by an embodiment of the present disclosure is shown in FIG. Figure 6 As shown, including:
[0155] An acquisition unit 41 is used to acquire a bit plane corresponding to a video frame of a video to be encrypted;
[0156] A segmentation unit 42, configured to segment the image matrix to obtain a preset number of bit planes;
[0157] A mutation unit 43, configured to determine a target mutation rule for each bit plane according to the bit value count in each bit plane, and perform a mutation operation on each bit plane according to the target mutation rule;
[0158] The first reorganization unit 44 is used to perform a plane reorganization operation according to the mutated bit plane to obtain the mutated pixel matrix.
[0159] The video information encryption device provided by the present disclosure has a main technical solution including: obtaining the bit plane corresponding to the video frame of the video to be encrypted; determining the target mutation rule of each bit plane according to the bit value count in each bit plane, and performing mutation operation on each bit plane according to the target mutation rule; performing plane reorganization operation according to the mutated bit plane to obtain the mutated pixel matrix. Compared with the related art, the embodiment of the present application performs parallel scrambling on the global of the video frame by constructing a pixel ring, and constructs a bit mutation rule, and performs plane-level encryption on each bit plane according to the characteristics of each bit plane itself. The mutation rule does not follow the video transmission and the mutation rule is diverse. Even if the transmitted video is leaked, it cannot be reversely deciphered through the encrypted video, which effectively hides the video information and enhances the confidentiality of the video.
[0160] Furthermore, in a possible implementation of the embodiment of the present disclosure, as Figure 7 As shown, the acquisition unit 41 also includes:
[0161] The first segmentation module 411 is used to segment the video frame of the video to be encrypted into pixel rings;
[0162] The combining module 412 is used to combine the pixel rings obtained by segmentation based on the index array to obtain an image matrix.
[0163] Furthermore, in a possible implementation of the embodiment of the present disclosure, as Figure 7 As shown, the segmentation unit 42 includes:
[0164] An acquisition module 421 is used to acquire the bit value of each pixel in the image matrix;
[0165] The second segmentation module 422 is used to segment the image matrix according to the number of bits of the bit value to obtain bit planes with the same number of bits as the bit value; wherein a bit plane contains the same number of bits of bit values for each pixel.
[0166] Furthermore, in a possible implementation of the embodiment of the present disclosure, as Figure 7 As shown, the mutation unit 43 is also used for:
[0167] Counting 0s and 1s for each bit plane to obtain a first statistical number of bit values of 0 and a second statistical number of bit values of 1 for each bit plane;
[0168] When the first statistical quantity is greater than the second statistical quantity, determining the target mutation rule is to perform an inversion operation on the bit value in the bit plane whose bit position is an even number, and adding a first preset identifier to the bit plane; wherein the preset identifier includes the mutation rule of the bit plane, different mutation rules correspond to different preset identifiers, and the preset identifier is used to decrypt the video according to the mutation rule corresponding to the preset identifier when decrypting the video;
[0169] When the first statistical number is less than the second statistical number, determining the target mutation rule is to perform a negation operation on the bit value in the bit plane with an odd bit position, and adding a second preset identifier to the bit plane;
[0170] When the first statistical quantity is equal to the second statistical quantity, it is determined that the target mutation rule is to perform an inversion operation on the bit values in all the bit planes, and to add a third preset identifier to the bit plane.
[0171] Furthermore, in a possible implementation of the embodiment of the present disclosure, as Figure 7 As shown, the segmentation module 411 is also used for:
[0172] The video frame is scanned and segmented in parallel based on at least two threads; wherein the number of threads is determined according to the size of the video frame.
[0173] Furthermore, in a possible implementation of the embodiment of the present disclosure, as Figure 7 As shown, the device also includes:
[0174] A construction unit 45 is used to construct a seed matrix based on a preset function and the hash value of the video to be encrypted before the segmentation module 411 performs pixel ring segmentation on the video frame of the video to be encrypted;
[0175] A first calculation unit 46, used to calculate the index value of the link matrix element according to the coordinate index of the seed matrix and the preset parameters;
[0176] A determination unit 47, configured to determine the parameters and initial values of the chaotic system according to the index values of the link matrix elements and the random elements in the random seed matrix;
[0177] The output unit 48 is used to output a chaotic random sequence according to the chaotic system to obtain the index array.
[0178] Furthermore, in a possible implementation of the embodiment of the present disclosure, as Figure 7 As shown, the device also includes:
[0179] A second reorganization unit 49 is used for reorganizing the index array based on a preset sorting function after the output unit 48 outputs the chaotic random sequence according to the chaotic system to obtain the index array;
[0180] The combining module 412 is also used for:
[0181] The pixel rings obtained by segmentation are combined based on the reorganized index array to obtain an image matrix.
[0182] Furthermore, in a possible implementation of the embodiment of the present disclosure, as Figure 7 As shown, the device also includes:
[0183] An acquisition unit 410 is configured to obtain a first random array and a second random array output by the chaotic system after the first reorganization unit 44 performs a plane reorganization operation according to the mutated bit plane to obtain the mutated pixel matrix;
[0184] A second calculation unit 411 is used to calculate the first row of pixels of the image matrix and the first random array to obtain a first row diffusion sequence;
[0185] A third calculation unit 412 is used to calculate the second row of pixels of the image matrix according to the first row diffusion sequence to obtain a second row diffusion sequence, and repeat the calculation steps until the calculation of each row of pixels in the pixel matrix is completed;
[0186] The second calculation unit 411 is further configured to calculate the first column of pixels of the image matrix after being calculated by the first random array with the second random array to obtain a first column diffusion sequence;
[0187] The third calculation unit 412 is further used to calculate the second column of pixels of the image matrix according to the first column diffusion sequence to obtain a second column diffusion sequence, and repeat the calculation steps until the calculation of each column of pixels in the pixel matrix after the first random array calculation is completed.
[0188] It should be noted that the above explanation of the method embodiment is also applicable to the device of the embodiment of the present disclosure, and the principle is the same, which is no longer limited in the embodiment of the present disclosure.
[0189] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.
[0190] Figure 8A schematic block diagram of an example electronic device 500 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0191] like Figure 8 As shown, the device 500 includes a computing unit 501, which can perform various appropriate actions and processes according to a computer program stored in a ROM (Read-Only Memory) 502 or a computer program loaded from a storage unit 508 to a RAM (Random Access Memory) 503. In the RAM 503, various programs and data required for the operation of the device 500 can also be stored. The computing unit 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An I / O (Input / Output) interface 505 is also connected to the bus 504.
[0192] A number of components in the device 500 are connected to the I / O interface 505, including: an input unit 506, such as a keyboard, a mouse, etc.; an output unit 507, such as various types of displays, speakers, etc.; a storage unit 508, such as a disk, an optical disk, etc.; and a communication unit 509, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 509 allows the device 500 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0193] The computing unit 501 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 501 include, but are not limited to, a CPU (Central Processing Unit), a GPU (Graphic Processing Units), various dedicated AI (Artificial Intelligence) computing chips, various computing units running machine learning model algorithms, a DSP (Digital Signal Processor), and any appropriate processor, controller, microcontroller, etc. The computing unit 501 performs the various methods and processes described above, such as an encryption method for video information. For example, in some embodiments, the encryption method for video information may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 508. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 500 via the ROM 502 and / or the communication unit 509. When the computer program is loaded into the RAM 503 and executed by the computing unit 501, one or more steps of the method described above may be performed. Alternatively, in other embodiments, the computing unit 501 may be configured to execute the aforementioned encryption method for video information in any other appropriate manner (eg, by means of firmware).
[0194] Various embodiments of the systems and techniques described above herein may be implemented in digital electronic circuit systems, integrated circuit systems, FPGAs (Field Programmable Gate Arrays), ASICs (Application-Specific Integrated Circuits), ASSPs (Application Specific Standard Products), SOCs (System On Chips), CPLDs (Complex Programmable Logic Devices), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include: being implemented in one or more computer programs that may be executed and / or interpreted on a programmable system including at least one programmable processor that may be a dedicated or general-purpose programmable processor that may receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0195] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0196] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any suitable combination of the foregoing. More specific examples of machine-readable storage media may include electrical connections based on one or more lines, portable computer disks, hard disks, RAM, ROM, EPROM (Electrically Programmable Read-Only-Memory) or flash memory, optical fiber, CD-ROM (Compact Disc Read-Only Memory), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0197] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (Cathode-Ray Tube) or LCD (Liquid Crystal Display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0198] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: LAN (Local Area Network), WAN (Wide Area Network), the Internet, and blockchain networks.
[0199] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship between the client and the server is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services ("Virtual Private Server", or "VPS" for short). The server may also be a server of a distributed system, or a server combined with a blockchain.
[0200] It should be noted that artificial intelligence is a discipline that studies how computers can simulate certain human thought processes and intelligent behaviors (such as learning, reasoning, thinking, planning, etc.), and includes both hardware-level and software-level technologies. Artificial intelligence hardware technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, and big data processing; artificial intelligence software technologies mainly include computer vision technology, speech recognition technology, natural language processing technology, as well as machine learning / deep learning, big data processing technology, knowledge graph technology, and other major directions.
[0201] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0202] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A method for encrypting video information, characterized in that: include: Obtaining a bit plane corresponding to a video frame of a video to be encrypted; Determine a target mutation rule for each bit plane according to the bit value count in each bit plane, and perform a mutation operation on each bit plane according to the target mutation rule; A plane reorganization operation is performed according to the mutated bit plane to obtain the mutated pixel matrix.
2. The method according to claim 1, characterized in that: The step of obtaining a bit plane corresponding to a video frame of the video to be encrypted comprises: Segment the video frame of the video to be encrypted into pixel rings, and combine the pixel rings obtained by segmentation based on the index array to obtain an image matrix; The image matrix is segmented to obtain a preset number of bit planes.
3. The method according to claim 2, characterized in that The segmenting of the image matrix to obtain a preset number of bit planes comprises: Get the bit value of each pixel in the image matrix; The image matrix is divided according to the number of bits of the bit value to obtain bit planes with the same number of bits as the bit value; wherein a bit plane contains the same number of bits of bit values for each pixel.
4. The method according to claim 3, characterized in that Determining the target mutation rule of each bit plane according to the bit value count in each bit plane, and performing mutation operation on each bit plane according to the target mutation rule includes: Counting 0s and 1s for each bit plane to obtain a first statistical number of bit values of 0 and a second statistical number of bit values of 1 for each bit plane; When the first statistical quantity is greater than the second statistical quantity, determining the target mutation rule is to perform an inversion operation on the bit value in the bit plane whose bit position is an even number, and adding a first preset identifier to the bit plane; wherein the preset identifier includes the mutation rule of the bit plane, different mutation rules correspond to different preset identifiers, and the preset identifier is used to decrypt the video according to the mutation rule corresponding to the preset identifier when decrypting the video; When the first statistical number is less than the second statistical number, determining the target mutation rule is to perform a negation operation on the bit value in the bit plane with an odd bit position, and adding a second preset identifier to the bit plane; When the first statistical quantity is equal to the second statistical quantity, it is determined that the target mutation rule is to perform an inversion operation on the bit values in all the bit planes, and to add a third preset identifier to the bit plane.
5. The method according to claim 2, characterized in that: The pixel ring segmentation of the video frame of the video to be encrypted also includes: The video frame is scanned and segmented in parallel based on at least two threads; wherein the number of threads is determined according to the size of the video frame.
6. The method according to claim 2, characterized in that Before the video frame of the video to be encrypted is segmented into pixel rings, the method further includes: Constructing a seed matrix based on a preset function and the hash value of the video to be encrypted; Calculating the index value of the link matrix element according to the coordinate index of the seed matrix and the preset parameters; Determining parameters and initial values of the chaotic system according to the index values of the link matrix elements and the random elements in the random seed matrix; The index array is obtained according to the chaotic random sequence output by the chaotic system.
7. The method according to claim 6, characterized in that After obtaining the index array according to the chaotic random sequence output by the chaotic system, the method further includes: Reorganizing the index array based on a preset sorting function; The pixel rings obtained by segmentation are combined based on the index array to obtain an image matrix including: The pixel rings obtained by segmentation are combined based on the reorganized index array to obtain an image matrix.
8. The method according to any one of claims 1 to 7, characterized in that After performing a plane reorganization operation according to the mutated bit plane to obtain the mutated pixel matrix, the method further includes: Obtaining a first random array and a second random array output by the chaotic system; Calculating the first row of pixels of the image matrix and the first random array to obtain a first row diffusion sequence; Calculating the second row of pixels of the image matrix according to the first row diffusion sequence to obtain a second row diffusion sequence, and repeating the calculation steps until the calculation of each row of pixels in the pixel matrix is completed; Calculating the first column of pixels of the image matrix after being calculated by the first random array and the second random array to obtain a first column diffusion sequence; The second column of pixels of the image matrix is calculated according to the first column diffusion sequence to obtain a second column diffusion sequence, and the calculation steps are repeated until the calculation of each column of pixels in the pixel matrix after the first random array calculation is completed.
9. A video information encryption device, characterized in that: include: An acquisition unit, used for acquiring a bit plane corresponding to a video frame of a video to be encrypted; A mutation unit, used to determine a target mutation rule for each bit plane according to the bit value count in each bit plane, and perform a mutation operation on each bit plane according to the target mutation rule; The first reorganization unit is used to perform a plane reorganization operation according to the mutated bit plane to obtain the mutated pixel matrix.
10. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 8.
11. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-8.
12. A computer program product, characterized in that The invention comprises a computer program which, when executed by a processor, implements the method according to any one of claims 1 to 8.