Video Encryption Method Based on SM4 and Dynamic S-Box

By introducing an encryption scheme based on SM4 and dynamic S box in the video encryption method, using Chen Huantun system to generate dynamic S box, improving the SM4 algorithm, solving the problems of small key space, lossy encryption process or weak security in the existing video encryption method, and achieving efficient and secure video data encryption.

CN114629619BActive Publication Date: 2025-06-10YAZHENG TECH GRP CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210201706.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-03
Publication Date
2025-06-10
Estimated Expiration
2042-03-03

AI Technical Summary

Technical Problem

The existing video encryption methods have problems such as small key space, lossy encryption process or weak security, which makes it difficult to effectively ensure the security of video data in network transmission and storage.

Method used

Using video encryption methods based on SM4 and dynamic S box, dynamic S box is generated through Chen Huantun system, SM4 algorithm is improved, lossless encryption of video data is realized, and the security of the encryption process is improved.

Benefits of technology

This method improves the security and efficiency of video encryption, increases the key space, ensures the losslessness of the encryption process, and effectively protects the privacy of video data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114629619B_ABST
    Figure CN114629619B_ABST
Patent Text Reader

Abstract

A Video Encryption Method Based on SM4 and Dynamic S-Box. Currently, activities of video communication over the network are becoming increasingly frequent. To ensure the security of video network transmission, a video encryption method based on SM4 and dynamic S-Box is proposed. First, the video is decoded into the original YUV stream format, and the Y, U, and V components are decomposed. Second, a dynamic S-Box is generated using chaos. Third, the improved SM4 algorithm is used to encrypt the Y component. Finally, the encrypted Y component is combined with the original U and V components to form an encrypted video, which is then encoded into the original format. Method analysis and experimental results show that the new method has high security and can resist common attacks such as statistical attacks, differential attacks, and brute-force attacks.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to an information encryption technology, and particularly to a video stream encryption method. Background Art

[0002] In the current era of rapid information development, the security problem of video stream data is becoming increasingly serious. With the rapid development of network technology and various portable electronic devices, video image information plays an increasingly significant role in production and social life. The equipment cost and communication cost required to watch videos have decreased significantly, bringing great convenience to people's production and life. However, due to the openness and sharing nature of the Internet itself, the transmission of videos on the Internet still faces the problems of being illegally stolen and spread, and leaking personal privacy. The security problems of video information transmission and storage have attracted widespread attention and emphasis.

[0003] Videos have characteristics such as fast propagation speed, a large amount of information transmitted, and intuitiveness. To ensure the network storage and transmission security of video content, various video encryption methods have been proposed. However, current video encryption methods often have problems such as low encryption efficiency, lossy encryption processes, or weak security.

[0004] To protect the security of video network transmission and storage, SM4 and chaos are combined to generate a dynamic S-box, and a video encryption method based on SM4 and the dynamic S-box is proposed, whose decryption process is lossless. At the same time, the dynamic S-box generated by the chaos system is sensitive to the initial value and has strong reliability, which better improves the dynamic nature of the method. Summary of the Invention

[0005] The object of the present invention: Aiming at the problems existing in the existing video encryption methods, such as small key space, lossy encryption process, or weak security, a video encryption method based on SM4 and a dynamic S-box is proposed.

[0006] The technical solution of the present invention: To achieve the above object of the invention, the technical solution adopted is a video encryption method based on SM4 and a dynamic S-box, and its encryption steps are described in detail as follows:

[0007] Step 1: Decoding the original video: The original video P 1 consists of k images with a frame size of m × n . Convert P 1 from formats such as rmvb, avi, or mp4 to the video raw data YUV format. The converted video is P 2 ;

[0008] Step 2: Decomposing the video YUV: From P2 Decompose the Y, U, and V components from it, and their magnitudes are respectively m × n × k、 ( m / 2)×( n / 2)× k and ( m / 2)×( n / 2)× k ;

[0009] Step 3: Generate a chaotic sequence: The Chen chaotic system is:

[0010] , (1)

[0011] where, when the control parameters a = 35, b = 3 and c = 28, the system is in a chaotic state; Randomly select the initial values x 0 , y 0 , z 0 , and iterate 356 times according to formula (1) to generate 3 chaotic sequences with a length of 356 each X 1 , Y 1 , Z 1 , remove the first 100 values of X 1 , Y 1 , Z 1 , and obtain 3 new sequences with a length of 256 each X 2 , Y 2 , Z 2 ;

[0012] Step 4: Integerize the chaotic sequence: Calculate:

[0013] X 3 = uint 8(( X 2 -min ( X 2 )) / ( max ( X 2 ) -min (X 2 )) × 255), (2)

[0014] Y 3 =uint 8(( Y 2 -min ( Y 2 )) / ( max ( Y 2 ) -min ( Y 2 )) × 255), (3)

[0015] Z 3 = uint 8(( Z 2 -min ( Z 2 )) / ( max ( Z 2 ) -min ( Z 2 )) × 255), (4)

[0016] Among them, unit 8(·) is a function that converts a double - precision variable to an 8 - bit unsigned integer, max (·) is a function that accesses the maximum element of an array, min (·) is a function that accesses the minimum element of an array, X 3 , Y 3 , Z 3 is an integer chaotic sequence;

[0017] Step 5: Generate a dynamic S - box: Calculate:

[0018] S X = reshape ( X 3 , 16, 16), (5)

[0019] S Y = reshape ( Y 3 , 16, 16), (6)

[0020] S Z =reshape ( Z 3 , 16, 16), (7)

[0021] in, S X , S Y , S Z To generate three dynamic S-boxes of size 16×16, reshape (·) is the array reconstruction function. Table 1 shows the original static S-box of SM4 algorithm. S o, calculate:

[0022] S d 1 = S o⊕ S X , (8)

[0023] S d 2 = S o⊕ S Y , (9)

[0024] S d 3 = S o⊕ S Z , (10)

[0025] Among them, ⊕ is an XOR operation, and we can get three dynamic S-boxes of size 16×16 S d 1 , S d 2 , S d 3 ;

[0026] Step 6: SM4 algorithm improvement: plaintext data U 1 is 128 bits, U 1 Split into 4 equal parts of 32 bits X 0 , X 1 , X 2 ,X 3 ,Right now U 1 =( X 0 , X 1 , X 2 , X 3 );calculate:

[0027] A = X i+1 ⊕ X i+2 ⊕ X i+3 ⊕ R i , i =0, 1, …, 31, (11)

[0028] in, R i is the round key, A is a 32-bit binary number. A Split into four equal parts of 8 bits a 0 , a 1 , a 2 , a 3 ,Right now =( a 0 , a 1 , a 2 , a 3 );calculate:

[0029] B = t ( A )=( Sbox ( a 0 ), Sbox ( a 1 ), Sbox ( a 2 ), Sbox ( a 3 )), (12)

[0030] in, Sbox (·) is the S-box transformation, t(·) is a nonlinear transformation, which is essentially a parallel S-box transformation. The S-box transformation converts the value formed by the combination of the first 2 bits and the last 2 bits of the input 8-bit byte into a hexadecimal number as the row of the S-box, and the value formed by the middle 4 bits into a hexadecimal number as the column of the S-box. The number in the S-box determined by the row and column is the output of the S-box transformation. Here, the S-box is randomly selected. S d 1 , S d 2 or S d 3 One of them, yes a 0 , a 1 , a 2 , a 3 Perform S-box transformation separately to generate 8-bit binary numbers b 0 , b 1 , b 2 , b 3 ,Right now B = ( b 0 , b 1 , b 2 , b 3 );

[0031] L ( B )= B ⊕( B <<2)⊕( B <<10)⊕( B <<18)⊕( B <<24), (13)

[0032] in, L (·) is a linear transformation, << is a bitwise left shift operation; L The output of (·) is the same as X i XOR, complete a round of iteration,

[0033] X i+4 = X i ⊕ T ( A ), i= 0, 1, …, 31, (14)

[0034] Among them, T (·) = L ( t (·)) is a composite function composed of t (·) and L (·); After a total of 32 rounds of iteration, the output results are successively: X 4 , X 5 , …,[[]]END]] X 35 ; U 2 = ( X 35 , X 34 , X 33 , X 32 ) is the ciphertext data;

[0035] Table 1 The original static S-box of the SM4 algorithm S o:

[0036]

[0037] Step 7: Encrypt the video stream: Divide the Y-component data into groups of length 128 in a certain way, use the algorithm in Step 6 to encrypt the grouped data, and combine the encrypted Y-component with the original U and V components to form a video P 3 ;

[0038] Step 8: Video encoding: Encode P 3 into the format of the original video to obtain the encrypted video P 4 .

[0039] The decryption process is the reverse process of the encryption process. In the decryption process, the same chaotic sequence is generated using Chen chaos, and the original video can be decrypted.

[0040] Beneficial effects: (1) Three dynamic S-boxes are generated using the Chen chaos system, and an improved method of SM4 is proposed; (2) A video encryption method based on SM4 and dynamic S-boxes is proposed; (3) Method analysis and experimental results show that the proposed new method has good security and encryption efficiency. Description of the drawings

[0041] Figure 1 : Video encryption flowchart based on SM4 and dynamic S-boxes;

[0042] Figure 2 : Grayscale one frame of the original Y component;

[0043] Figure 3 : Encrypt one frame of the Y component. Specific implementation mode

[0044] The following further elaborates on the implementation mode of the present invention in combination with specific drawings and examples.

[0045] Figure 1 It is an encryption flow chart based on SM4 and a dynamic S-box.

[0046] The programming software used is Matlab R2019b, and Figure 2 encrypts one frame of the grayscaled Y component shown. Using the proposed encryption method based on SM4 and a dynamic S-box, the encryption process is detailed as follows.

[0047] Step 1: Decode the original video: The original video P 1 consists of 120 images with a size of 160×120. Convert P 1 from the avi format to the video raw data YUV format. After conversion, the video is P 2 ;

[0048] Step 2: Decompose the video YUV: Decompose P 2 into the Y, U, and V components, with sizes of 160×120×120, 80×60×120, and 80×60×120 respectively;

[0049] Step 3: Generate chaotic sequences: Select the initial values of the Chen chaotic system x 0 = 2, y 0 = 1, z 0 = 3 and the control parameters a = 35, b = 3 and c = 28. Iterate 356 times according to formula (1) to generate 3 chaotic sequences with lengths of 1×356 each X 1 , Y 1 , Z 1 , and remove X 1 , Y 1 , Z 1The first 100 values can obtain 3 new sequences, each with a length of 256 X 2 , Y 2 , Z 2 ;

[0050] Step 4: Integerize the chaotic sequence: Calculate according to formulas (2)-(4) for X 2 , Y 2 , Z 2 to generate 3 integer chaotic sequences with a length of 1×256 X 3 , Y 3 , Z 3 ;

[0051] Step 5: Generate dynamic S-boxes: Generate 3 dynamic S-boxes, each with a size of 16×16, according to formulas (5)-(7) S X , S Y , S Z , and after performing XOR operations with the dynamic S-boxes given in the above table, 3 dynamic S-boxes with a size of 16×16 can be obtained S d 1 , S d 2 , S d 3 ;

[0052] Step 6: Improvement of the SM4 algorithm: Let the plaintext data U 1 be 128 bits, and divide U 1 into 4 equal parts of 32 bits X 0 , X 1 , X 2 , X 3 ; Calculate the 32-bit binary number A according to formula (11), and split A into 4 equal parts of 8 bits a 0 , a 1 , a 2 ,a 3 , perform S-box transformation on a 0 , a 1 , a 2 , a 3 respectively to generate 8-bit binary numbers b 0 , b 1 , b 2 , b 3 ; After performing linear transformation according to formula (13) and iterating through formula (14), after a total of 32 rounds of iteration, the output results are successively: X 4 , X 5 , …, X 35 ; U 2 = ( X 35 , X 34 , X 33 , X 32 ) is the ciphertext data;

[0053] Step 7: Encrypt the video stream: Divide the Y-component data into groups of length 128 in a certain way, use the improved SM4 algorithm in Step 6 to encrypt the grouped data, and combine the encrypted Y-component with the original U and V components to form a video P 3 ; Encrypt one frame of the Y-component, as Figure 3 shown;

[0054] Step 8: Video encoding: Encode P 3 into the avi format to obtain the encrypted video P 4 .

[0055] The decryption process is the reverse of the encryption process. During the decryption process, the same chaotic sequence is generated using Chen chaos to decrypt the original video.

Claims

1. Video encryption method based on SM4 and dynamic S-box, characterized in that, the encryption process includes the following steps: Step 1: Decode the original video: The original video P 1 consists of k frames of images with a size of m×n. Convert P 1 from the original video format to the YUV video format. The original video format includes rmvb, avi, or mp4. The converted video is P 2 ; Step 2: Video YUV Decomposition: Decompose Y, U, and V components from P 2 with sizes m×n×k, (m / 2)×(n / 2)×k, and (m / 2)×(n / 2)×k respectively; Step 3: Generate a chaotic sequence: The Chen chaotic system is: Among them, when the control parameters a = 35, b = 3, and c = 28, the system is in a chaotic state; randomly select the initial values x 0 , y 0 , z 0 of the Chen chaotic system. Iterate 356 times according to formula (1) to generate three chaotic sequences X 1 , Y 1 , Z 1 with a length of 356 each. Remove the first 100 values of X 1 , Y 1 , Z 1 to obtain three new sequences X 2 , Y 2 , Z 2 with a length of 256 each; Step 4: Integerize the chaotic sequence: Calculate: X 3 = uint8((X 2 - min(X 2 )) / (max(X 2 ) - min(X 2 )) × 255), (2) Y 3 = uint8((Y 2 - min(Y 2 )) / (max(Y 2 ) - min(Y 2 )) × 255), (3) Z 3 = uint8((Z 2 - min(Z 2 )) / (max(Z 2 ) - min(Z 2 )) × 255), (4) Among them, unit8(·) is a function that converts a double-precision variable into an 8-bit unsigned integer, max(·) is a function that accesses the maximum element of an array, min(·) is a function that accesses the minimum element of an array, X 3 , Y 3 , Z 3 is an integer chaotic sequence; Step 5: Generate a dynamic S-box: Calculate: S X = reshape(X 3 , 16, 16), (5) S Y = reshape(Y 3 , 16, 16), (6) S Z = reshape(Z 3 , 16, 16), (7) Among them, S X , S Y , S Z are three generated dynamic S-boxes each with a size of 16×16, and reshape(·) is a function for reconstructing arrays. The following table is the original static S-box So of the SM4 algorithm, Calculate: S d 1 = So⊕S X , (8) S d 2 = So ⊕ S Y , (9) S d 3 = So⊕S Z , (10) Among them, ⊕ is the exclusive-or operation, and 3 dynamic S-boxes S with a size of 16×16 can be obtained d 1 , S d 2 , S d 3 ; Step 6: Improvement of the SM4 algorithm: Let the plaintext data U 1 be 128 bits, and divide U 1 into 4 equal parts X 0 of 32 bits, X 1 , X 2 , X 3 , namely U 1 = (X 0 , X 1 , X 2 , X 3 ); Calculate: wherein, R i is the round key, A is a 32-bit binary number, and A is split into four equal parts a 0 , a 1 , a 2 , a 3 , that is, A = (a 0 , a 1 , a 2 , a 3 ); Calculate: B = t(A) = (Sbox(a 0 ), Sbox(a 1 ), Sbox(a 2 ), Sbox(a 3 ), (12) where Sbox(·) is the S-box transformation, t(·) is the non-linear transformation, which is essentially a parallel S-box transformation; the S-box transformation is to convert the value formed by combining the first 2 bits and the last 2 bits of the input 8-bit byte into a hexadecimal number as the row of the S-box, and the value formed by the middle 4 bits into a hexadecimal number as the column of the S-box, and the number in the S-box determined by the row and column is the output of the S-box transformation; Here, the S-box is randomly selected from S d 1 , S d 2 or S d 3 . For a0 , a1 , a 2 , a 3 , perform the S-box transformation respectively to generate 8-bit binary numbers b 0 , b 1 , b 2 , b 3 , that is, B = (b 0 , b 1 , b 2 , b 3 ); where, L(·) is a linear transformation, and << is a bit left shift operation; the output of L(·) is XORed with X i to complete one round of iteration, and X i+4 = X i ⊕ T(A), i = 0, 1, …, 31, (14) where \(T(\cdot)=L(t(\cdot))\) is a composite function composed of \(t(\cdot)\) and \(L(\cdot)\); after a total of 32 rounds of iteration, the output results are successively: \(X\) 4 , \(X\) 5 , …, \(X\) 35 ; \(U\) 2 = \((X\) 35 , \(X\) 34 , \(X\) 33 , \(X\) 32 ) is the ciphertext data; Step 7: Encrypt the video stream: Divide the Y-component data into groups of length 128 in a certain way, use the improved SM4 algorithm in Step 6 to encrypt the grouped data, and combine the encrypted Y-component with the original U and V components to form video P 3 ; Step 8: Video Encoding: Encode P 3 into the format of the original video to obtain the encrypted video P 4 .

Citation Information

Patent Citations

  • Video stream-oriented hybrid encoding and encrypting method

    CN102905133A

  • Multi-audio encryption method based on chaos and DNA coding

    CN112073171A