Real-time video encryption and decryption method and system based on multi-thread scrambling diffusion
By employing a scrambling and diffusion method that generates key sequences through multi-threaded parallel processing and a chaotic mapping algorithm, the problem of slow video encryption speed is solved, and real-time video encryption is achieved.
Patent Information
- Application Number
- CN202310591117.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-22
- Publication Date
- 2025-12-09
- Estimated Expiration
- 2043-05-22
AI Technical Summary
Existing video encryption algorithms are too time-consuming to meet the speed requirements of real-time video encryption, and traditional text encryption algorithms such as DES and AES are not suitable for image encryption.
A multi-threaded scrambling and diffusion method is adopted, in which multiple sub-threads are created by the main thread to process video frame images in parallel, and a chaotic mapping algorithm is used to generate a key sequence for image scrambling and diffusion, thereby realizing video encryption and decryption.
It improves video encryption speed, reduces the strong correlation between image pixels, and achieves real-time video encryption.
Smart Images

Figure CN116527964B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of image encryption technology, and particularly relates to a real-time video encryption and decryption method and system based on multi-thread scrambling diffusion. BACKGROUND
[0002] In recent years, with the rapid development of information technology, the security encryption technology of multimedia data has become a research hotspot. Video encryption technology plays an indispensable role in the military field and people's production and life. For example, it plays an important role in many applications such as military databases, secret video conferences, pay-per-view television, health management systems, online private photo albums, etc. Video encryption speed is the key to realize real-time video encryption. Due to the strong correlation between adjacent pixels, traditional DES, AES and other encryption algorithms for text are not suitable for image encryption. In order to ensure the security of encrypted images, the mainstream encryption algorithm is based on the scrambling-diffusion encryption and decryption structure, that is, the image encryption scheme performs multiple rounds of confusion and diffusion to protect the image from attacks. However, this operation takes a long time and cannot meet the real-time requirements of video encryption. SUMMARY
[0003] In view of the problems existing in the prior art, the present application provides a real-time video encryption and decryption method and system based on multi-thread scrambling diffusion, which effectively improves the video encryption speed and realizes the effect of real-time video encryption. The technical scheme is as follows:
[0004] In the first aspect, a real-time video encryption method based on multi-thread scrambling diffusion is provided, comprising the following steps:
[0005] (1) The main thread obtains a key K and an original video V, and the main thread creates n encryption tasks taking a single frame image in the original video V as an object;
[0006] (2) The main thread creates n sub-threads, and the main thread respectively calls each sub-thread to execute an encryption task, one sub-thread corresponding to one encryption task;
[0007] (3) Based on the encryption task completed by the sub-thread, a single frame image completed encryption is obtained as the output result of real-time video encryption;
[0008] In the (2), the sub-thread executes the encryption task, which includes a1 times of scrambling, a2 rounds of diffusion and a3 rounds of scrambling diffusion cycle for the image corresponding to the encryption task, and the key sequence required by the sub-thread executing the encryption task is obtained based on the double key stream generation process of the key K.
[0009] Further, in the (1), the main thread creates n encryption tasks taking a single frame image in the original video V as an object, including: the main thread obtains a single frame image to be encrypted, divides the single frame image into n local images, and takes the encryption of each local image as an encryption task.
[0010] The (2) comprises:
[0011] (211) The main thread creates n sub-threads, and the sub-threads acquire a key sequence required when performing an encryption task, and wait for the main thread to wake up;
[0012] (212) The main thread wakes up the n sub-threads to perform the encryption task;
[0013] (213) The n sub-threads perform the encryption task in parallel, and encrypt a local image by using multi-round permutation and diffusion, and one of the sub-threads performs encryption processing on one local image;
[0014] (214) After the sub-threads complete the encryption, the sub-threads notify the main thread, and enter a waiting state;
[0015] (215) After the n sub-threads complete the encryption of the n local images, the main thread outputs a single-frame image whose encryption is completed.
[0016] Further, the permutation in the (2) is performed by using a discretization Chirikov standard map method to perform image permutation:
[0017]
[0018] Where (x i ,y i ) is the position of an image pixel point, (x i+1 ,y i+1 ) is the position of a pixel point after permutation, N is the size of the image, and K is a parameter, and the larger the value is, the better.
[0019] The diffusion in the encryption task performed by the sub-threads is performed by using
[0020]
[0021] Where c(i) is the encryption result of a current pixel, k(i) is a key sequence used in the diffusion process, p(i) is the current pixel, c(i-1) is a previous encrypted pixel, and N is the size of the image.
[0022] Further, the (1) main thread creates n encryption tasks by taking a single-frame image in the original video V as an object, and the n encryption tasks comprise:
[0023] The main thread creates a buffer area;
[0024] The main thread stores multiple single-frame images in the buffer area queue as an encryption task for each single-frame image;
[0025] The (2) comprises:
[0026] (221)The main thread creates n sub-threads and 1 auxiliary thread, and the sub-threads obtain the key sequence required for executing the encryption task;
[0027] (222)The n sub-threads execute the encryption task in parallel, and encrypt a single frame image by using multi-round permutation and diffusion, and one of the sub-threads encrypts one of the single frame images;
[0028] (223)After the sub-threads complete the encryption, the single frame images encrypted are output by the auxiliary thread.
[0029] Further, the key sequence required for the sub-threads to execute the encryption task is obtained based on the double key stream generation process of the key K, including:
[0030] The main thread generates a first key sequence P l1 , l1=1, 2,..., n, n is the number of data in the first key sequence,
[0031] The sub-threads respectively generate a second key sequence P l1l2 , l2=1, 2,..., M, M is the number of data in each second key sequence, based on each data in the first key sequence by using the chaotic mapping algorithm.
[0032] Further, the chaotic mapping algorithm includes the PLCM algorithm and the 2DLASM algorithm.
[0033] In the second aspect, based on the real-time video encryption method, a real-time video decryption method is provided, including: the main thread creates n sub-threads, the main thread respectively calls each sub-thread to execute a decryption task, one sub-thread corresponds to one decryption task, and the key sequence required for the decryption task is the key sequence required for the sub-threads to execute the encryption task.
[0034] Further, the real-time video decryption method includes: the sub-threads perform a2 times of diffusion inverse process, a1 times of permutation inverse process, and a3 times of loop on each image corresponding to each decryption task to obtain plaintext,
[0035] Wherein, the inverse operation process of diffusion is:
[0036]
[0037] The inverse operation process of permutation is:
[0038]
[0039] Wherein, (x i , y i ) is the position of the current encrypted image pixel point, (x i+1 , yi+1 ) is the pixel position after the inverse permutation change, that is, the decrypted position, and N is the size of the image.
[0040] In a third aspect, a real-time video encryption system based on multi-thread permutation diffusion is provided, comprising:
[0041] An encryption task creation unit is configured to acquire a key K and an original video V by a main thread, and the main thread creates n encryption tasks with single-frame images in the original video V as objects.
[0042] An encryption task execution unit is configured to create n sub-threads by the main thread, and the main thread respectively calls each sub-thread to execute an encryption task, and one sub-thread corresponds to one encryption task.
[0043] An encryption result acquisition unit is configured to acquire a single-frame image completed by encryption as an output result of real-time video encryption based on the encryption task completed by the sub-thread.
[0044] In the encryption task execution unit, the sub-thread executing the encryption task includes a1 times of permutation, a2 rounds of diffusion and a3 rounds of permutation diffusion cycles on the image corresponding to the encryption task, and a key sequence required by the sub-thread executing the encryption task is acquired based on a double key stream generation process of the key K.
[0045] In a fourth aspect, a real-time video transmission system based on multi-thread permutation diffusion is provided, comprising a video image sending device and a video image receiving device, the video image sending device is configured to execute the real-time video encryption method based on multi-thread permutation diffusion in the first aspect, and the video image receiving device is configured to execute the real-time video decryption method based on multi-thread permutation diffusion in the second aspect.
[0046] The real-time video encryption and decryption method and system based on multi-thread permutation diffusion have the following beneficial effects: single-frame images in an original video are taken as objects to create n encryption tasks, n encryption and decryption tasks are executed in parallel based on n sub-threads, and the speed of video encryption is effectively improved. BRIEF DESCRIPTION OF DRAWINGS
[0047] Figure 1 FIG. 1 is a flowchart of an embodiment one of the real-time video encryption method based on multi-thread permutation diffusion;
[0048] Figure 2 FIG. 8 is a schematic diagram of a key sequence acquisition process required by the sub-thread executing the encryption task;
[0049] Figure 3 FIG. 9 is a schematic diagram of n sub-threads in parallel encryption of the embodiment one of the real-time video encryption method;
[0050] Figure 4is a buffer area method schematic diagram of embodiment two of the real-time video encryption method;
[0051] Figure 5 is a flowchart schematic diagram of embodiment two of the real-time video encryption method;
[0052] Figure 6 is a structure schematic diagram of the real-time video encryption system based on multi-thread scrambling diffusion. DETAILED DESCRIPTION
[0053] The real-time video transmission system based on multi-thread scrambling diffusion provided in the embodiments of the present application includes a video image sending device and a video image receiving device. The video image sending device encrypts an original image, and the video image receiving device decrypts the encrypted image. In the embodiments, the real-time video transmission system based on multi-thread scrambling diffusion can be used for encrypting and transmitting a video. The video image sending device can be a terminal, and then the real-time video encryption method based on multi-thread scrambling diffusion is executed by the terminal. Of course, the video image sending device can also be a server, for example, a server interacting with the terminal. The terminal sends a video to the server, and the server executes the real-time video encryption method based on multi-thread scrambling diffusion. Similarly, the video image receiving device can also be a terminal or a server. The video image receiving device is built-in with a program for executing the real-time video decryption method based on multi-thread scrambling diffusion, so as to decrypt the video image. In the embodiments, the encryption process of the original video image is the upper half, and the decryption process is the lower half. The encryption method and the decryption method are further described below.
[0054] In the embodiments of the present application, to solve the encryption and decryption speed of real-time video, a real-time video encryption and decryption method based on parallel computing is provided. The input video is split or buffered, and the different parts of a single frame image or different single frame images are processed simultaneously through multi-thread parallel computing, so as to effectively improve the video encryption and decryption speed and realize real-time video encryption and decryption. Based on the above method of splitting or buffering the input video, the real-time video encryption method based on multi-thread scrambling diffusion is described in the following embodiments.
[0055] Embodiment one
[0056] Referring to Figure 1 The real-time video encryption method based on multi-thread scrambling diffusion provided in the embodiments of the present application includes the following steps:
[0057] (1) The main thread obtains a key K and an original video V. The main thread takes a single frame image in the original video V as an object, and creates n encryption tasks;
[0058] (2) the main thread creates n sub-threads, and the main thread respectively calls each sub-thread to execute an encryption task, and one sub-thread corresponds to one encryption task;
[0059] (3) based on the encryption task completed by the sub-thread, a single-frame image that is encrypted is obtained as an output result of real-time video encryption;
[0060] In the (2), the sub-thread executing the encryption task includes: performing a1 times of permutation, a2 rounds of diffusion and a3 rounds of permutation and diffusion cycles on the image corresponding to the encryption task, and a key sequence required by the sub-thread executing the encryption task is obtained based on a double key stream generation process of a key K.
[0061] In the embodiment of the application, the a1 times of permutation, the a2 rounds of diffusion and the a3 rounds of permutation and diffusion cycles are used for encryption, so that a better encryption effect is achieved, and the strong correlation between image pixels can be effectively reduced.
[0062] In the embodiment of the application, in order to ensure the synchronization and mutual exclusion between the multiple sub-threads, the single-frame image is divided into n local images, each sub-thread accesses one local image to perform an image encryption task, and different sub-threads process different local images.
[0063] Specifically, referring to Figure 3 The (1) creates n encryption tasks, including: the main thread obtains a single-frame image to be encrypted, divides the single-frame image into n local images, and encrypts each local image as one encryption task.
[0064] Further, the (2) n sub-threads in parallel, including the following steps:
[0065] (211) the main thread creates n sub-threads, the sub-threads obtain a key sequence required for executing an encryption task, and wait for the main thread to wake up;
[0066] (212) the main thread wakes up the n sub-threads to execute the encryption task;
[0067] (213) the n sub-threads execute the encryption task in parallel, encrypt the local images by using multiple rounds of permutation and diffusion, and one sub-thread encrypts and processes one local image;
[0068] (214) after the sub-thread completes the encryption, the main thread is notified to enter a waiting state;
[0069] (215) the n sub-threads complete the encryption of the n local images, and the main thread outputs the single-frame image that is encrypted.
[0070] Specifically, in the steps (211)-(215), the single frame image of the video is split into n local images, and in an embodiment, the single frame image of the video can be uniformly split. The main thread calls n sub-threads, and one of the sub-threads performs encryption processing on one local image. The n sub-threads perform parallel scrambling and diffusion operations to improve the encryption and decryption speed. Specifically, the main thread Tm completes video frame extraction to obtain continuous multiple frames of images. The main thread obtains a single frame image to be processed. The main thread wakes up the sub-threads to complete the encryption operation. The main thread waits for the sub-threads to complete the encryption operation. After the sub-threads obtain the key sequence required for performing the encryption task, the sub-threads wait for the main thread to wake up. After the sub-threads complete the encryption operation, the sub-threads notify the main thread and enter a waiting state. When the n sub-threads all complete the encryption operation, the main thread processes the next frame of image. When the n sub-threads all complete the encryption operation, the ciphertext image corresponding to the single frame image is output.
[0071] Further, referring to Figure 2 The flowchart for obtaining the key sequence required for the encryption process by each sub-thread is shown in FIG. 2. In step (1), the main thread generates a first key sequence P l1 , l1=1, 2,..., n, n being the number of data in the first key sequence, according to the key K by using a chaotic mapping algorithm.
[0072] The main thread assigns the n data in the first key sequence to the n sub-threads, respectively, that is, one sub-thread receives one key parameter for generating a second key sequence.
[0073] Further, in step (2), the sub-threads generate a second key sequence P l1l2 , l2=1, 2,..., M, M being the number of data in each second key sequence, according to each data in the first key sequence by using a chaotic mapping algorithm.
[0074] Further, in step (2), after the main thread creates the n sub-threads and each sub-thread obtains the second key sequence, the sub-thread waits for the main thread to wake up. After the main thread wakes up, each sub-thread uses its own second key sequence to perform a multi-round scrambling and diffusion encryption process on the local image to be encrypted by the sub-thread.
[0075] In the embodiment, the main thread generates a first key sequence P l1 , l1=1, 2,..., n, n being the number of data in the first key sequence, according to the key key by using a chaotic mapping algorithm. l1l2 That is, the n sub-threads generate n second key sequences, and each second key sequence P l1l2The pixel of the image corresponding to the encryption task is diffused.
[0076] The sub-thread converts the second key sequence into a byte sequence, and completes the diffusion operation. The image ciphertext encrypted by using the second key sequence is transmitted to a receiving device, and the receiving device decrypts the image ciphertext by using the same key parameter and key generation function.
[0077] The chaotic mapping algorithm used to generate the first / second key sequence, the permutation algorithm used in the encryption process, and the diffusion algorithm are described below.
[0078] The permutation algorithm used in the encryption process uses the discretization Chirikov standard map method to perform image permutation:
[0079]
[0080] where (x i ,y i ) is the position of the image pixel point, (x i+1 , y i+1 ) is the pixel point position after permutation change, N is the size of the image, and K is a parameter, which is better the larger the value is.
[0081] The diffusion algorithm used in the encryption process uses where c(i) is the encryption result of the current pixel, k(i) is the key sequence used in the diffusion process, which is the key stream generated by the chaotic function, that is, the second key sequence, p(i) is the current pixel, c(i-1) is the previous encrypted pixel, and N is the size of the image.
[0082] In the embodiment of the application, each sub-thread or process realizes permutation of a local image to a single-frame image full image. In the diffusion, although different sub-threads process different local images, each local image is independent, but in the diffusion, the pixels of other images are used as seeds to complete the diffusion operation on each local image, and the relationship between the local images is reconstructed. The value of any pixel point in the frame is changed, and even if the same key is used for encryption, completely different ciphertexts are obtained. The encryption system is sensitive to plaintext to resist known / selected plaintext attacks.
[0083] The chaotic mapping algorithm used to generate the first / second key sequence includes but is not limited to the PLCM algorithm and the 2DLASM algorithm. Among them:
[0084] The PLCM algorithm uses a segmented mapping function to generate a key stream, and the PLCM algorithm is as follows:
[0085]
[0086] where x0 is the initial factor, p is the control parameter. p∈[0, 0.5), x0∈[0, 1] is the initial condition, the p and x0 parameters are brought in, and the key stream is iteratively generated.
[0087] 2DLASM algorithm generates a key stream by using two-dimensional Logistic sine mapping,
[0088]
[0089] where the parameter μ∈[0, 1]. According to two inputs x0, y0, the key stream is iteratively generated.
[0090] Embodiment two
[0091] Referring to Figure 4 and 5 The real-time video encryption method based on multi-thread scrambling diffusion provided by the embodiment of the application comprises the following steps:
[0092] (1) The main thread acquires a key K and an original video V, and the main thread creates n encryption tasks by taking a single-frame image in the original video V as an object;
[0093] (2) The main thread creates n sub-threads, and the main thread respectively calls each sub-thread to execute an encryption task, and one sub-thread corresponds to one encryption task;
[0094] (3) Based on the encryption task completed by the sub-thread, a single-frame image after encryption is acquired as an output result of real-time video encryption;
[0095] In the step (2), the sub-thread executing the encryption task comprises: performing a1 times of scrambling, a2 rounds of diffusion and a3 rounds of scrambling and diffusion cycles on the image corresponding to the encryption task, and a key sequence required by the sub-thread executing the encryption task is acquired based on a double key stream generation process of the key K.
[0096] Specifically, the step (1) of creating n encryption tasks comprises: the main thread creates a buffer area; and the main thread stores multiple single-frame images in a buffer area queue by taking encryption of each single-frame image as an encryption task.
[0097] Further, the step (2) comprises the following steps:
[0098] (221) The main thread Tm creates n sub-threads Ti and creates 1 auxiliary thread Td, and the sub-thread acquires a key sequence required when executing the encryption task;
[0099] (222) The n sub-threads execute the encryption tasks in parallel, and a single-frame image is encrypted by using multiple rounds of scrambling and diffusion, and one sub-thread encrypts one single-frame image;
[0100] (223)After the encryption of the sub-thread is completed, the encrypted single-frame image is output through the auxiliary thread.
[0101] In the embodiment of the present application, the acquired video frame is put into the cache area, an auxiliary thread is created in the main thread for output, and n sub-threads are used for encryption operation. The sub-threads process different frame pictures, the processed pictures are output by the auxiliary thread, and the cache space is released. Specifically, a plurality of single-frame images are stored in the cache area queue in the main thread, the single-frame images in the cache area queue are encrypted in the sub-thread, and the encrypted single-frame images are output from the cache area queue in the auxiliary thread. The single-frame images processed by the sub-thread are marked, and the single-frame images that have completed the encryption operation are marked. The synchronization and mutual exclusion between threads are realized by using the semaphore. In this embodiment, the reading video process and the outputting encrypted image process satisfy the synchronization and mutual exclusion, and the processed pictures are output while being read into the process.
[0102] In the embodiment of the present application, the remaining implementation steps are the same as those of the above embodiment, and will not be described here.
[0103] The real-time video decryption method based on multi-thread scrambling diffusion is described below. The real-time video decryption method based on multi-thread scrambling diffusion provided in the embodiment of the present application includes the following steps:
[0104] The video image encrypted based on the real-time video encryption method based on multi-thread scrambling diffusion is received, and the key K and the key sequence generation method used when the encrypted video image is received are also received.
[0105] The main thread creates n sub-threads, and the main thread calls each sub-thread to execute a decryption task. One sub-thread corresponds to one decryption task, and the key sequence required by the decryption task is the key sequence required when the sub-thread executes an encryption task, that is, the key sequence required when decrypting is generated by the key K and the key sequence generation method used when encrypting the video image.
[0106] The sub-thread performs a2 times of diffusion inverse process, a1 times of scrambling inverse process, and a3 times of loop on the image corresponding to each decryption task to obtain the plaintext, wherein the inverse operation process of diffusion is:
[0107]
[0108] The inverse operation process of scrambling is:
[0109]
[0110] (x i , y i ) is the position of the current encrypted image pixel point, and (x i+1 , y i+1) is the pixel position after the inverse permutation change, that is, the decrypted position, and N is the size of the image.
[0111] Referring to Figure 6 Based on the above real-time video encryption method based on multi-thread permutation diffusion, the embodiment of the application further provides a real-time video encryption system based on multi-thread permutation diffusion, which comprises:
[0112] An encryption task creation unit is configured to acquire a key K and an original video V by a main thread, and the main thread creates n encryption tasks by taking a single-frame image in the original video V as an object;
[0113] An encryption task execution unit is configured to create n sub-threads by the main thread, and the main thread respectively calls each sub-thread to execute an encryption task, and one sub-thread corresponds to one encryption task.
[0114] An encryption result acquisition unit is configured to acquire a single-frame image completed by encryption as an output result of real-time video encryption based on the encryption task completed by the sub-thread.
[0115] In the encryption task execution unit, the sub-thread executing the encryption task comprises: a1 times of permutation, a2 rounds of diffusion and a3 rounds of permutation diffusion cycles on the image corresponding to the encryption task, and the key sequence required by the sub-thread executing the encryption task is acquired based on a double key stream generation process of the key K.
[0116] The specific limitation of the real-time video encryption system based on multi-thread permutation diffusion can be referred to the limitation of the real-time video encryption method based on multi-thread permutation diffusion in the above, and will not be repeated here. Each unit in the above real-time video encryption system based on multi-thread permutation diffusion can be realized by software, hardware and combinations thereof in whole or in part. The above each unit can be embedded in or independent of the processor in the computer device in hardware form, or can be stored in the memory in the computer device in software form, so as to be called and executed by the processor to execute the operation corresponding to each unit.
[0117] The application is not limited to the above specific embodiments, and various modifications made by those skilled in the art without creative labor, all of which fall within the protection scope of the application.
Claims
1. A real-time video encryption method based on multi-thread scrambling diffusion, characterized in that, The method comprises the following steps: (1) the main thread acquires a key K and an original video V, and the main thread creates n encryption tasks with single-frame images in the original video V as objects; (2) the main thread creates n sub-threads, and the main thread respectively calls each sub-thread to execute an encryption task, and one sub-thread corresponds to one encryption task; (3) based on the encryption task completed by the sub-thread, a single-frame image completed by encryption is acquired as an output result of real-time video encryption; In the (2), the sub-thread performs the encryption task, which includes a1 times permutation, a2 rounds of diffusion and a3 rounds of permutation and diffusion cycles on the image corresponding to the encryption task, and the key sequence required by the sub-thread for performing the encryption task is obtained based on the double key stream generation process of the key K; the double key stream generation process includes that the main thread generates a first key sequence P l1 based on the key K by using a chaotic mapping algorithm, l1=1, 2,..., n, n is the number of data in the first key sequence, and the sub-thread generates a second key sequence P l1l2 based on each data in the first key sequence by using the chaotic mapping algorithm, l2=1, 2,..., M, M is the number of data in each second key sequence.
2. The real-time video encryption method based on multi-thread scrambling diffusion according to claim 1, characterized in that: in the step (1), the main thread creates n encryption tasks with single-frame images in the original video V as objects, and the step comprises the following steps: the main thread acquires a single-frame image to be encrypted, and divides the single-frame image into n local images, and the encryption of each local image is regarded as one encryption task; the step (2) comprises the following steps: (211) the main thread creates n sub-threads, and the sub-threads acquire a key sequence required when executing an encryption task and wait for the main thread to wake up; (212) the main thread wakes up the n sub-threads to execute the encryption task; (213) the n sub-threads execute the encryption task in parallel, and the local images are encrypted by using multi-round scrambling and diffusion, and one sub-thread encrypts one local image; (214) after the sub-thread completes the encryption, the main thread is informed, and the sub-thread enters a waiting state; 3. A real-time video encryption method based on multi-thread confusion diffusion according to claim 2, characterized in that, (215) after the n sub-threads complete the encryption of the n local images, the main thread outputs the single-frame image completed by encryption. where (x i ,y i ) is the position of the image pixel point, (x i+1 , y i+1 ) is the pixel point position after permutation change, N is the size of the image, and K is a parameter; in the step (2), the scrambling is performed by using a discretization Chirikov standard map method to replace the image; in the step (2), the diffusion in the encryption task executed by the sub-thread is performed by using 4. The real-time video encryption method based on multi-thread confusion diffusion according to claim 1, characterized in that, wherein c(i) is an encryption result of a current pixel, k(i) is a key sequence used in the diffusion process, p(i) is the current pixel, c(i-1) is a previous encrypted pixel, and N is the size of the image. the chaotic mapping algorithm comprises a PLCM algorithm and a 2DLASM algorithm.
5. The real-time video encryption method based on multi-thread scrambling diffusion according to claim 1, characterized in that: in the step (1), the main thread creates n encryption tasks with single-frame images in the original video V as objects, and the step comprises the following steps: the main thread creates a buffer area; the main thread regards the encryption of each single-frame image as one encryption task, and stores multiple single-frame images in a buffer area queue; the step (2) comprises the following steps: (221) the main thread creates n sub-threads and one auxiliary thread, and the sub-threads acquire a key sequence required when executing an encryption task; (222) the n sub-threads execute the encryption task in parallel, and the single-frame images are encrypted by using multi-round scrambling and diffusion, and one sub-thread encrypts one single-frame image; 6. A real-time video decryption method based on multi-threaded scrambling diffusion of the real-time video encryption method according to any one of claims 1-5, characterized in that, (223) after the sub-thread completes the encryption, the single-frame image completed by encryption is output by the auxiliary thread. the step (3) comprises the following steps:
7. The real-time video decryption method according to claim 6, characterized in that, the main thread creates n sub-threads, and the main thread respectively calls each sub-thread to execute a decryption task, and one sub-thread corresponds to one decryption task, and the key sequence required by the decryption task is the key sequence required when the sub-thread executes the encryption task. the step (4) comprises the following steps: The sub-thread performs a2 diffusion inverse processes, a1 permutation inverse processes and a3 cycles on the image corresponding to each decryption task to obtain the plaintext, The inverse operation process of the diffusion is: The inverse operation process of the permutation is: where (x i ,y i ) is the position of the current encrypted image pixel point, (x i+1 ,y i+1 ) is the pixel point position after the inverse change of permutation, that is, the decrypted position, and N is the size of the image.
8. A real-time video encryption system based on multi-threaded permutation diffusion characterized in that, The method comprises: The encryption task creation unit is configured to obtain the key K and the original video V by the main thread, and create n encryption tasks by taking a single-frame image in the original video V as an object by the main thread; The encryption task execution unit is configured to create n sub-threads by the main thread, and execute the encryption tasks by the main thread by calling each sub-thread respectively, and one sub-thread corresponds to one encryption task; The encryption result acquisition unit is configured to obtain the single-frame image after the encryption is completed as the output result of the real-time video encryption based on the encryption task completed by the sub-thread. In the encryption task execution unit, the sub-thread executes the encryption task by performing a1 times of permutation, a2 rounds of diffusion and a3 rounds of permutation and diffusion cycle on the image corresponding to the encryption task, and the key sequence required by the sub-thread in executing the encryption task is obtained based on the double key stream generation process of the key K; the double key stream generation process comprises: the main thread generates a first key sequence P l1 based on the key K by using a chaotic mapping algorithm, wherein l1=1, 2,..., n, n is the number of data in the first key sequence, and the sub-thread generates a second key sequence P l1l2 based on each data in the first key sequence by using the chaotic mapping algorithm, wherein l2=1, 2,..., M, M is the number of data in each second key sequence.
9. A real-time video transmission system based on multi-threaded shuffling diffusion, characterized in that, The video image sending device is configured to execute the real-time video encryption method based on the multi-thread permutation diffusion in any one of claims 1 to 5, and the video image receiving device is configured to execute the real-time video decryption method based on the multi-thread permutation diffusion in any one of claims 6 to 7.
Citation Information
Patent Citations
Password system for privacy protection of electronic medical images of Internet of Things
CN113141359A