Data encryption methods, decryption methods, devices, computer equipment, and storage media

By dividing the data stream into data fragments and embedding them into the first pixel layer generated by the pixel index mapping table, the problem of lack of dynamic updates in traditional GIF file frames is solved, and real-time encrypted transmission and security of the data stream are achieved.

CN120935309BActive Publication Date: 2026-01-30CHONGQING JINKANG NEW ENERGY VEHICLE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511462057.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-10-14
Publication Date
2026-01-30
Estimated Expiration
2045-10-14

AI Technical Summary

Technical Problem

Traditional GIF files lack a dynamic frame update mechanism, making it impossible to dynamically embed data streams. This results in difficulties in real-time data embedding and transmission, limited information embedding capacity, and easy detection.

Method used

The real-time input data stream is divided into data segments according to a preset length, embedded into the first pixel layer dynamically generated by the pixel index mapping table, and dynamic image frames are generated and segmentation markers are added to achieve real-time encrypted transmission of data.

Benefits of technology

It enables real-time generation of image frames and real-time embedding of data fragments, ensuring the real-time performance and security of the data stream during transmission and reducing the risk of data decryption errors or loss.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120935309B_ABST
    Figure CN120935309B_ABST
Patent Text Reader

Abstract

The application relates to a data encryption method and device, a decryption method and device, computer equipment and a storage medium. The method comprises the following steps: cutting a real-time input data stream into a data segment according to a preset length; calling a first pixel layer used for generating a dynamic image frame, embedding the data segment into the first pixel layer to obtain a second pixel layer; the first pixel layer is dynamically generated according to a pre-stored pixel index mapping table, and the pixel index mapping table is used for defining a pixel index arrangement rule of the first pixel layer; and based on the second pixel layer, a dynamic image frame after encryption of the data segment is generated, the dynamic image frame comprises a segment marker, and the segment marker is a segmentation identifier of different image frames, which is beneficial to realizing real-time encryption transmission of the data stream.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of information security transmission technology, and in particular to a data encryption method, decryption method, apparatus, computer equipment, and storage medium. Background Technology

[0002] GIF (Graphics Interchange Format) steganography and transmission technology can hide secret information in GIF image files and transmit them covertly over the network or other communication channels. It combines the principles of data steganography and data transmission.

[0003] However, all frames (including frame content, control parameters, etc.) of a traditional GIF file are pre-generated and fixedly encoded in the GIF file. Its format design lacks a dynamic frame update mechanism and cannot achieve dynamic embedding of data streams. Summary of the Invention

[0004] Therefore, it is necessary to provide a data encryption method, apparatus, computer device, computer-readable storage medium, and computer program product capable of dynamically embedding data into GIF image frames to address the aforementioned technical problems.

[0005] In a first aspect, this application provides a data encryption method, the method comprising:

[0006] The real-time input data stream is divided into a data slice according to a preset length;

[0007] The first pixel layer used to generate dynamic image frames is invoked, and the data fragments are embedded into the first pixel layer to obtain the second pixel layer; the first pixel layer is dynamically generated according to a pre-stored pixel index mapping table, which is used to define the pixel index arrangement rules of the first pixel layer;

[0008] Based on the second pixel layer, a dynamic image frame is generated after the data slices are encrypted. The dynamic image frame includes a segmentation marker, which is a segmentation identifier for different image frames.

[0009] Secondly, this application also provides a data encryption device, the device comprising:

[0010] The data segmentation module is used to segment the real-time input data stream into at least one data segment according to a preset length.

[0011] The pixel layer generation module is used to call the first pixel layer used to generate dynamic image frames, embed the data slices into the first pixel layer, and obtain the second pixel layer; the first pixel layer is dynamically generated according to a pre-stored pixel index mapping table, which is used to define the pixel index arrangement rules of the first pixel layer;

[0012] The image frame generation module is used to generate a dynamic image frame after the data slices are encrypted based on the second pixel layer. The dynamic image frame includes a segmentation marker, which is a segmentation identifier for different image frames.

[0013] Thirdly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the data encryption method described above.

[0014] Fourthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the data encryption method described above.

[0015] Fifthly, this application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the data encryption method described above.

[0016] The aforementioned data encryption method, apparatus, computer equipment, computer-readable storage medium, and computer program product divide a real-time input data stream into a data segment according to a preset length; call a first pixel layer used to generate dynamic image frames, and embed the data segment into the first pixel layer to obtain a second pixel layer; the first pixel layer is dynamically generated according to a pre-stored pixel index mapping table, which defines the pixel index arrangement rules of the first pixel layer; based on the second pixel layer, a dynamic image frame is generated after encrypting the data segment in the data stream. The dynamic image frame includes a segmentation marker, which serves as a segmentation identifier for different image frames. By dividing the real-time data stream into data segments and embedding the data segments into the first pixel layer dynamically generated based on the pixel index mapping table to obtain the second pixel layer, and finally generating an encrypted dynamic image frame based on the second pixel layer, the segmentation marker enables frame-by-frame segmentation of the dynamic image frame, which is beneficial for real-time generation of image frames and real-time embedding of data segments, thereby ensuring the real-time performance and security of the data stream during transmission.

[0017] Sixthly, this application provides a data decryption method, the method comprising:

[0018] The system receives dynamic image frames sent in real time by the data sending end, and extracts the second pixel layer and segmentation markers included in the dynamic image frames; the segmentation markers are the segmentation identifiers for different image frames.

[0019] The first pixel layer that matches the second pixel layer is invoked. The first pixel layer is dynamically generated based on a pre-stored pixel index mapping table, which is used to define the pixel index arrangement rules of the first pixel layer.

[0020] Based on the difference between the second pixel layer and the first pixel layer that matches the second pixel layer, and the pixel index mapping table, the data fragments embedded in the second pixel layer are extracted.

[0021] Seventhly, this application also provides a data encryption device, the device comprising:

[0022] The pixel layer extraction module is used to receive dynamic image frames sent in real time by the data sending end, and extract the second pixel layer and segmentation markers included in the dynamic image frames; the segmentation markers are the segmentation identifiers of different image frames.

[0023] The pixel layer calling module is used to call the first pixel layer that matches the second pixel layer. The first pixel layer is dynamically generated according to a pre-stored pixel index mapping table, which is used to define the pixel index arrangement rules of the first pixel layer.

[0024] The data fragment extraction module is used to extract the data fragments embedded in the second pixel layer based on the difference between the second pixel layer and the first pixel layer that matches the second pixel layer and the pixel index mapping table.

[0025] Eighthly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the data decryption method described above.

[0026] Ninthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the data decryption method described above.

[0027] In a tenth aspect, this application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the data decryption method described above.

[0028] In an eleventh aspect, this application also provides a data transmission system, the system comprising:

[0029] The data sending end is used to divide the real-time input data stream into a data slice according to a preset length; it calls the first pixel layer used to generate dynamic image frames, and embeds the data slice into the first pixel layer to obtain a second pixel layer; the first pixel layer is dynamically generated according to a pre-stored pixel index mapping table, which is used to define the pixel index arrangement rules of the first pixel layer; based on the second pixel layer, it generates a dynamic image frame after encrypting the data slice in the data stream, and sends the dynamic image frame to the data receiving end in real time; the dynamic image frame includes a segmentation marker, which is a segmentation identifier for different image frames;

[0030] The data receiving end is used to receive dynamic image frames sent in real time by the data sending end, extract the second pixel layer and segmentation markers included in the dynamic image frames; the segmentation markers are segmentation identifiers for different image frames; call the first pixel layer that matches the second pixel layer, the first pixel layer is dynamically generated according to a pre-stored pixel index mapping table, the pixel index mapping table is used to define the pixel index arrangement rules of the first pixel layer; based on the difference between the second pixel layer and the first pixel layer that matches the second pixel layer, the global color table and the pixel index mapping table, extract the data fragments embedded in the second pixel layer.

[0031] The aforementioned data decryption method, apparatus, computer equipment, computer-readable storage medium, and computer program product receive dynamic image frames transmitted in real time by a data transmitter, extract the second pixel layer and segmentation markers included in the dynamic image frames; the segmentation markers are segmentation identifiers for different image frames; call the first pixel layer that matches the second pixel layer, which is dynamically generated according to a pre-stored pixel index mapping table used to define the pixel index arrangement rules of the first pixel layer; and extract data fragments embedded in the second pixel layer based on the differences between the second pixel layer and the first pixel layer that matches the second pixel layer and the pixel index mapping table. By receiving dynamic image frames, extracting the second pixel layer and segmentation markers from the dynamic image frames, and calling the first pixel layer that matches the second pixel layer dynamically generated using the pre-stored pixel index mapping table, the data fragments embedded in the second pixel layer can be accurately extracted by comparing the differences between the first pixel layer and the second pixel layer. This effectively ensures the accuracy of data extraction, and the entire decryption process is efficient and reliable, which helps reduce the risk of data errors or loss during decryption, thereby improving the stability and security of data transmission and processing. Attached Figure Description

[0032] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments of this application or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0033] Figure 1 This is an application environment diagram of a data encryption method / data decryption method in one embodiment;

[0034] Figure 2 This is a flowchart illustrating a data encryption method in one embodiment;

[0035] Figure 3 This is a flowchart illustrating the invocation of the first pixel layer step in one embodiment;

[0036] Figure 4 This is a flowchart illustrating a data decryption method in one embodiment;

[0037] Figure 5 This is a structural block diagram of a data encryption method apparatus in one embodiment;

[0038] Figure 6 This is a structural block diagram of a data decryption method apparatus in one embodiment;

[0039] Figure 7 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0040] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0041] It should be noted that the terms "first," "second," etc., used in this application can be used to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish the first element from the second element. The terms "comprising" and "having," and any variations thereof, used in this application, are intended to cover non-exclusive inclusion. The term "multiple" used in this application refers to two or more. The term "and / or" used in this application refers to one of the embodiments, or any combination of multiple embodiments.

[0042] Image compression and transmission have become crucial components of multimedia communication. However, traditional data transmission technologies, such as HTTP (Hypertext Transfer Protocol)-based text and file transfer, frequently face challenges from network censorship and traffic monitoring, making covert communication difficult in certain environments. Furthermore, while GIF, as a common image format, is widely used due to its broad compatibility and animation support, it is generally not used for real-time data communication. This is because GIF animation frames are typically pre-generated, lacking a dynamic frame update mechanism, making real-time data embedding and transmission difficult. Attempts at data steganography using GIF images also suffer from limited information embedding capacity and susceptibility to detection tools, further limiting its application in covert communication. Despite the availability of various steganography and encryption techniques, technical challenges remain in balancing simplified implementation complexity, ensuring data covertness, and improving transmission compatibility.

[0043] For example, traditional GIF steganography relies on pre-generated complete files (such as the pre-existing terminator 0x3B), making continuous frame data streaming injection impossible. This results in limited steganography capacity and communication latency exceeding 300ms (as required by RFC 6201, where RFC stands for Request For Comments). Another example is the current HTTP chunked transmission scheme, which uses M-JPEG (Motion-Join Photographic Experts Group) to achieve real-time video, but older browsers (such as IE≤8) do not support the multipart / x-mixed-replace protocol, resulting in a device coverage rate of less than 61.2%. Furthermore, conventional encrypted tunneling technology uses TLS (Transport Layer Security) to encapsulate plaintext transmission. While ensuring data confidentiality, this exposes fixed handshake characteristics, such as SNI (Server Name Indication) / ALPN (Application-Layer Protocol Negotiation) extensions, allowing 69.8% of censorship systems to block communication via entropy detection. Meanwhile, existing GIF frame control technology can only achieve a fixed number of loops through the loop count field, lacking a real-time collaborative update mechanism for dynamic frame intervals (delay field, i.e., delay field) and color palette (act array), resulting in bandwidth utilization of less than 47B / frame.

[0044] The root cause of these problems is that traditional technologies treat GIFs as closed files rather than scalable communication protocols, and fail to effectively combine application-layer steganography with transport-layer flow control techniques.

[0045] The data encryption method provided in this application embodiment can be applied to, for example... Figure 1 The application environment shown is illustrated. Terminal 101 communicates with server 102 via a network. A data storage system can store the data that server 102 needs to process. The data storage system can be integrated onto server 102, or it can be located in the cloud or on another network server. When data is transmitted between multiple terminals 101 (which can be data receivers or data senders), terminal 101 can initiate a data encryption request to server 102. The data encryption request carries a data stream, and terminal 101 can transmit the data stream to server 102 in real time. Server 102 can receive the real-time input data stream and divide the real-time input data stream into a data segment according to a preset length. Then, server 102 can call the first pixel layer used to generate dynamic image frames and embed the data segment into the first pixel layer to obtain the second pixel layer. The first pixel layer is dynamically generated according to a pre-stored pixel index mapping table, which is used to define the pixel index arrangement rules of the first pixel layer. Then, based on the second pixel layer, server 102 generates a dynamic image frame after encrypting the data segment. The dynamic image frame includes a segmentation marker, which is a segmentation identifier for different image frames. Finally, server 102 sends the dynamic image frame to terminal 101 in real time.

[0046] Terminal 101 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, drones, low-altitude aircraft, IoT devices, and portable wearable devices. IoT devices can include smart speakers, smart TVs, smart air conditioners, smart in-vehicle devices, and projection equipment. Portable wearable devices can include smartwatches, smart bracelets, and head-mounted displays. Head-mounted displays can be virtual reality (VR) devices, augmented reality (AR) devices, and smart glasses. Server 102 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services.

[0047] In one exemplary embodiment, such as Figure 2 As shown, a data encryption method is provided, which can be applied to... Figure 1Taking server 102 as an example, which is deployed at the data sending end, this method can also be applied to terminal 101 and systems including terminal 101 and server 102, through interaction between terminal 101 and server 102. The method in this embodiment includes steps 201 to 203. Wherein:

[0048] Step 201: Divide the real-time input data stream into a data slice according to a preset length.

[0049] In this context, a data stream refers to a continuous collection of data arranged chronologically, where data is generated from a terminal and transmitted to a server in a flowing manner. Data in a data stream typically exists in the form of bytes. Byte data refers to data composed of bytes as the basic unit. In computers, 1 byte equals 8 bits (8 bits). Byte data is one of the basic forms of data processing and storage in computers. Various types of data, such as text data, image data, audio data, and video data, can ultimately be converted into byte data for processing within the computer. Based on this, the byte data to be encrypted can be the data obtained by converting the text data, image data, audio data, and video data to be encrypted into binary data. Data fragmentation refers to dividing long byte data into multiple smaller, relatively independent parts in a certain way. For example, in network transmission, the byte data corresponding to a piece of text data can be divided into multiple data fragments, each of which can include a certain number of bytes of data. Encrypting each data fragment separately can increase the flexibility and security of encryption.

[0050] For example, when a terminal initiates a data encryption request, the server can acquire and parse the data stream carried in the data encryption request, and convert the data stream into byte data that a computer can process, such as hexadecimal data or binary data. After receiving the data stream, the server can segment the byte data in the data stream according to a preset length, obtaining a data fragment. That is, the server can perform a length-based segmentation on the number of bytes received during the data stream reception process; when the preset length is reached, a data fragment is obtained. Taking the string "Hello" in the data stream as an example, the server can convert this string into an ASCII (American Standard Code for Information Interchange) sequence representation, namely 48, 65, 6C, 6C, 6F. Correspondingly, the string "Hello" can be represented as hexadecimal byte data, namely 0x48, 0x65, 0x6C, 0x6C, 0x6F, with each letter occupying one byte. Based on the data partition of the largest image in the subsequent image frames, the data can be fragmented into 273-byte segments to obtain a single data segment. During fragmentation, since 0x48, 0x65, 0x6C, 0x6C, and 0x6F are less than 273 bytes, pseudo-random bytes (such as 0x00) can be padded to the sixth byte and subsequent bytes until the 273rd byte, resulting in a data segment containing 273 bytes, namely 0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x00, ...

[0051] Step 202: Call the first pixel layer used to generate the dynamic image frame, embed the data slices into the first pixel layer, and obtain the second pixel layer.

[0052] In this context, a dynamic image frame refers to a single static image frame that constitutes a dynamic image (i.e., a GIF). Data fragments are embedded within the dynamic image frame to enable real-time, encrypted transmission of the data stream. The first pixel layer refers to the pixel data structure used to generate the dynamic image frame; that is, the pixel index corresponding to the current dynamic image frame before the data fragments are embedded. The first pixel layer can be dynamically generated based on a pre-stored pixel index mapping table. It includes pixel indices corresponding to several pixels to provide a suitable and standardized basic pixel index structure for subsequent data fragment embedding. The second pixel layer is the new pixel layer obtained after embedding the data fragments into the first pixel layer. Compared to the first pixel layer, the second pixel layer is visually similar, but the pixel indices differ due to the hidden data fragments.

[0053] The pixel index mapping table includes the pixel index arrangement rules for the first pixel layer. Specifically, the pixel index mapping table includes the pixel index arrangement rules for at least one dynamic image frame; that is, it can include the pixel index of one or more dynamic image frames. The pixel index mapping table pre-stores the mapping relationship between pixel positions and pixel indices. The pixel indices are also associated with color entries in the global color table. Through the global color table and the pixel index mapping table, the pixel position and pixel color of each pixel in the first pixel layer can be precisely controlled during the generation process, thereby obtaining a pixel layer with a specific pattern, shape, or texture. The global color representation provides a unified color reference for dynamic image frames. The global color table pre-stores color information corresponding to each color, stored in a specific data structure. When dynamically generating dynamic image frames, the color used by each pixel in the dynamic image frame can be determined based on the color information stored in the global color table, ensuring the consistency and standardization of the generated dynamic image frames in terms of color. When dynamically generating the first pixel layer, according to the rules specified in the pixel index mapping table, the corresponding pixel index can be assigned to each pixel point at each pixel position to obtain the first pixel layer. Then, the corresponding color entry is found according to the global color table, and finally, a dynamic image frame with visual color is generated.

[0054] For example, the server can invoke the first pixel layer used to generate the dynamic image frame; for instance, the server can extract the first pixel layer from a pre-generated blank image frame, or it can obtain a separate first pixel layer generated based on a pixel index mapping table. The server can embed data fragments into the first pixel layer to obtain the second pixel layer; for instance, the server can process the data fragments and embed them into the pixels included in the first pixel layer to obtain the second pixel layer.

[0055] In one optional embodiment, when the server invokes the first pixel layer, the first pixel layer may be contained within a pre-generated blank image frame. Specifically, upon receiving a data fragment, the server may invoke a pre-stored pixel index mapping table and generate a blank image frame according to the GIF89a specification. The server can then extract the pixel layers from this blank image frame to obtain the first pixel layer. In another optional embodiment, when the server invokes the first pixel layer, the first pixel layer may be generated separately. Specifically, upon receiving a data fragment, the server may invoke a pre-stored pixel index mapping table to directly generate a first pixel layer containing several pixels and perform an invocation operation on the generated first pixel layer.

[0056] In an optional embodiment, when generating the global color table, the server can divide the values ​​of the three channels R, G, and B from 0 to 255 according to the RGB (RED, GREEN, BLUE) color space distribution, generating 256 color entries. Each color entry occupies 3 bytes, with each channel occupying one byte, and these entries are sequentially filled into the pre-built global color table to obtain the global color table. For example, the values ​​of each of the R, G, and B channels can be evenly divided into 8 levels, with each level corresponding to values ​​of 0, 36, 73, 109, 146, 182, 219, and 255 respectively. Combining the three channels yields 256 color entries. For instance, the first color entry could be R=0, G=0, B=0; the second could be R=36, G=0, B=0; and the third could be R=0, G=36, B=0. An index is assigned to each color entry sequentially, i.e., the first color entry has an index of 0, the second has an index of 1, and so on, resulting in 256 color entries and their corresponding indices from 0 to 255. Each color entry and its corresponding index is then added to the global color table. Since each color entry occupies 3 bytes, the total size of the global color table (256 color entries) is 256 × 3 = 768 bytes, which conforms to the GIF89a specification (i.e., the global color table length is 2 bytes). n 256 = 2 8 (Meeting the requirements) to ensure the terminal can parse correctly. In some other embodiments, the channels can be divided into more levels to obtain more color entries, as long as they conform to the GIF89a specification and ensure the browser can parse them correctly.

[0057] Step 203: Based on the second pixel layer, generate a dynamic image frame after data fragmentation and encryption.

[0058] The dynamic image frame includes a segmentation marker, which serves as a segmentation identifier for different image frames. In other words, the segmentation marker is used to identify the segmentation information of the dynamic image frame. The segmentation marker can be a specific character, numerical value, or binary sequence, etc. In specific implementations, the segmentation marker can be implemented using a predefined data format. For example, the predefined data format may include, but is not limited to, data length limits and encoding methods for the segmentation marker. The segmentation marker can be generated according to a preset data format to mark the segmentation attribute of the dynamic image frame. Simultaneously, the segmentation marker can establish a correspondence between the dynamic image frame and the original data fragments through the fragment sequence number of the data fragment, facilitating the reassembly of the data stream.

[0059] For example, when the first pixel layer is generated separately by the server, the server can concatenate the second pixel layer and the segment marker according to the GIF 89a specification to obtain a dynamic image frame with encrypted data fragments. In other embodiments, when the first pixel layer is obtained by the server from a pre-generated blank image frame, the server can use the second pixel layer to replace the first pixel layer in the blank image frame and concatenate the segment marker with the second pixel layer to obtain a dynamic image frame with encrypted data fragments.

[0060] In an optional embodiment, the server can generate segmentation markers for dynamic image frames according to a predefined data format; the server can define the data length of the segmentation marker as two bytes and represent it in hexadecimal to generate the corresponding segmentation marker, such as 0x21F8.

[0061] In the aforementioned data encryption method, a data slice is obtained by dividing the real-time input data stream into a data segment according to a preset length; the first pixel layer used to generate dynamic image frames is called, and the data slice is embedded into the first pixel layer to obtain the second pixel layer; the first pixel layer is dynamically generated according to a pre-stored pixel index mapping table, which is used to define the pixel index arrangement rules of the first pixel layer; based on the second pixel layer, a dynamic image frame is generated after encrypting the data slice in the data stream. The dynamic image frame includes a segmentation marker, which serves as a segmentation identifier for different image frames. By dividing the real-time data stream into data slices and embedding the data slices into the first pixel layer dynamically generated based on the pixel index mapping table to obtain the second pixel layer, and finally generating an encrypted dynamic image frame based on the second pixel layer, the segmentation marker enables frame-by-frame segmentation of the dynamic image frame, which is beneficial for real-time generation of image frames and real-time embedding of data slices, thereby ensuring the real-time performance and security of the data stream during transmission.

[0062] In one embodiment, such as Figure 3 As shown, calling the first pixel layer used to generate the dynamic image frame includes:

[0063] Step 301: Obtain the global color table and pixel index mapping table for the dynamic image frame.

[0064] For example, the server can obtain a pre-stored global color table and pixel index mapping table for dynamic image frames.

[0065] Step 302: Invoke the pixel array used to generate the dynamic image frame and determine the pixel index combination for the pixel array from the pixel index mapping table.

[0066] In this context, a pixel array refers to a matrix structure formed by arranging multiple pixels according to a preset row and column rule. Each element in the pixel array corresponds to a pixel with a specific position and color, used to form the first pixel layer. Specifically, the pixel array has a fixed size, which can be determined based on factors such as the length of the data slices and the size of the generated dynamic image frames. A pixel index combination refers to the set of pixel indices extracted from the pixel index mapping table that match the current pixel array.

[0067] For example, the server can initialize a pixel array of a preset size based on the size of the dynamic image frame or the length of the data slice. For instance, the server can initialize an all-zero matrix based on the length of the data slice. Each element in this all-zero matrix corresponds to a blank pixel, and the value of each element is 0, meaning that the pixel index of each blank pixel is 0 or the pixel value is (0,0,0). The server can call the pixel array used to generate the dynamic image frame and determine the pixel index combination for the pixel array from the pixel index mapping table. For example, the server can use this all-zero matrix and then extract pixel indices from the pixel index mapping table with the same number of elements as the all-zero matrix, thus obtaining the pixel index combination.

[0068] In an optional embodiment, the pixel index mapping table may include pixel index mapping relationships that are much larger than the number of pixels in a pixel array. The pixel index mapping relationship is the correspondence between the original position of a pixel in the pixel array and the mapped position. When determining the pixel index combination, the server can extract the corresponding number of pixel index mapping relationships from the pixel index mapping table in sequence to obtain the pixel index combination.

[0069] Step 303: For each pixel in the pixel array, determine the pixel index of the target pixel from the pixel index combination according to the position of the target pixel in the pixel array.

[0070] The pixel index refers to the identification information used to look up the corresponding color entry in the global color table. In the specific implementation, the pixel index in the pixel index combination corresponds one-to-one with the pixel point in the pixel array. That is, each pixel point has a corresponding pixel index, and each pixel point can be associated with the global color table through the pixel index to present the corresponding pixel color. According to the corresponding index mapping rules, it is distributed in a specific position in the pixel array.

[0071] For example, for each pixel in the pixel array, the server can determine the pixel index of the target pixel from the pixel index combination according to the position of the target pixel in the pixel array. For example, the pixel index combination can be represented by a two-dimensional array with W×H elements (W is the width of the all-zero matrix, corresponding to W columns of all-zero matrix, and H is the height of the all-zero matrix, corresponding to H rows of all-zero matrix). Each element corresponds to the pixel index mapping relationship of a pixel. The two-dimensional array is extracted sequentially according to the height H of the all-zero matrix to form an intermediate matrix of H'×W' (H' is the width of the intermediate matrix, corresponding to H' columns of the intermediate matrix, H'=H, and W' is the height of the intermediate matrix, corresponding to W' rows of the intermediate matrix, W'=W). Then, the intermediate matrix is ​​transposed to obtain the transposed intermediate matrix with a size of W'×H'. The pixel index mapping relationship in the transposed intermediate matrix corresponds one-to-one with the position of each pixel in the all-zero matrix.

[0072] Step 304: Determine the pixel color of the target pixel from the global color table according to the pixel index, and fill the pixel with the pixel color to obtain the updated pixel.

[0073] Pixel color refers to the final color of a pixel, determined by the color parameter (such as RGB value) corresponding to the pixel index in the global color table. Color fill refers to the process of applying the pixel color obtained from the global color table through the pixel index to the corresponding pixel, that is, defining a specific color value for the pixel. The updated pixel is the pixel that has a clear color attribute after color fill.

[0074] For example, the server can determine the pixel color of a target pixel from the global color table according to the pixel index. For instance, the server can determine the pixel index of each pixel based on the mapping relationship between the pixel indices in the transposed intermediate matrix and the one-to-one correspondence between the positions of each pixel in the all-zero matrix, and then find the pixel color corresponding to that pixel index from the global color table. The server can then fill the pixel with the updated pixel color. For example, the server can assign the pixel values ​​(RGB values) corresponding to each pixel index defined in the global color table to the corresponding pixel, making the pixel display the corresponding color, thus obtaining the updated pixel.

[0075] Step 305: Obtain the first pixel layer based on each updated pixel.

[0076] For example, the server can obtain the first pixel layer based on each updated pixel; for instance, the server can stitch the updated pixels together according to the positions of the pixel array to obtain the first pixel layer.

[0077] In this embodiment, by obtaining the global color table and pixel index mapping table, and determining the pixel index of each pixel at each position based on the pixel position, and then determining the pixel color of the pixel from the global color table based on the pixel index and filling it, the first pixel layer is obtained. The whole process can accurately locate the pixel position based on the pixel index combination, and based on the one-to-one correspondence between pixel index, pixel color and pixel position, the corresponding first pixel layer can be dynamically and quickly generated for each data piece, which is conducive to realizing the real-time embedding of data pieces.

[0078] In one embodiment, the data encryption method further includes:

[0079] The graphics control extension block is obtained based on the image frame delay information; the image frame delay information is determined according to the fragment number of the data fragment and the delay factor of the dynamic image frame; the delay factor is determined according to the delay time of the dynamic image frame.

[0080] Furthermore, based on the second pixel layer, a dynamic image frame is generated after the data slices are encrypted, including:

[0081] Based on the second pixel layer and the graphics control extension block, dynamic image frames are generated after encryption of data fragments in the data stream.

[0082] Image frame delay information refers to the data structure information used to describe the display time of dynamic image frames. Image frame delay information is usually represented in hexadecimal, and a delay factor can be obtained from it using a delay conversion coefficient. The delay factor refers to the specific delay time of the dynamic image frame. The delay conversion coefficient is a benchmark coefficient used to convert between image frame delay information and the delay factor, transforming abstract image frame delay information into a specific delay time (i.e., the delay factor). The graphics control extension block is a data structure generated based on the image frame delay information and used to control the display behavior of dynamic image frames. The graphics control extension block can be used to store and transmit instructions related to image frame display, such as display time, image size, and alpha channel.

[0083] For example, the server can obtain a graphics control extension block based on image frame delay information. For instance, the server can determine the delay factor of a dynamic image frame based on its delay time, and determine the image frame delay information based on the data fragment sequence number and the dynamic image frame delay factor. It can then generate a graphics control extension block based on the image frame delay information. Alternatively, the server can call a graphics control extension block from a blank image frame and update it based on the image frame delay information. The server can generate a dynamic image frame encrypted for the data fragments in the data stream based on the second pixel layer and the graphics control extension block. For example, the server can concatenate the second pixel layer and the graphics control extension block according to the GIF 89a specification to obtain a dynamic image frame encrypted for the data fragments in the data stream.

[0084] In this embodiment, by using the data fragment sequence number and the delay factor determined based on the delay time to obtain the image frame delay information, and then generating the graphics control extension block, the fragment sequence number can be embedded into the graphics control extension block without affecting the display effect of the dynamic image frame, thereby increasing the concealment of data embedding.

[0085] In one embodiment, the graphics control extension block is obtained based on image frame delay information, including:

[0086] The delay factor of the dynamic image frame and the delay conversion coefficient for the image frame delay information are determined. Based on the delay factor and the delay conversion coefficient, the initial image frame delay information of the dynamic image frame is determined. The initial image frame delay information is binary expanded to obtain low-order delay information and high-order delay information. The fragment number of the data fragment is obtained. Based on the fragment number, the high-order delay information is updated to obtain the updated high-order delay information. The target image frame delay information is determined according to the low-order delay information and the updated high-order delay information, and the graphics control extension block is obtained based on the target image frame delay information.

[0087] The delay factor refers to the specific delay time of a dynamic image frame. The delay conversion coefficient is the base coefficient for converting image frame delay information and the delay factor; it can convert abstract image frame delay information into a specific delay time (i.e., the delay factor). The initial image frame delay information refers to the raw delay information calculated based on the delay factor and the delay conversion coefficient, reflecting the basic display time of the dynamic image frame. Binary expansion refers to the process of converting the numerical value of the initial image frame delay information into a binary representation. Low-order delay information and high-order delay information refer to the information obtained by dividing the binary data according to the number of bits after binary expansion of the initial image frame delay information. For example, if the initial image frame delay information is represented as 0x03E8 (1000 centimeters), it can be represented as 0000001111101000 after binary expansion, where 00000011 is the high-order delay information and 11101000 is the low-order delay information. Low-order delay information is used to retain the basic numerical part of the delay information, i.e., the delay time of the moving image frame. High-order delay information can be used to add additional information, such as writing the fragment sequence number of the data fragment into the high-order delay information to establish a correlation between the delay information and the data fragment. Updated high-order delay information refers to the new delay information obtained after embedding the fragment sequence number into the high-order delay information. The target image frame delay information refers to the final delay information formed by combining the low-order delay information and the updated high-order delay information.

[0088] The fragment number is a unique identifier assigned to each data fragment during the data stream segmentation process, such as 1, 2, 3, etc. The fragment number identifies the position and order of the data fragment within the original data stream, ensuring the integrity and continuity of the recovered data stream during subsequent data decryption.

[0089] For example, the server can determine the delay factor of the dynamic image frame and the delay conversion coefficient for the image frame delay information, and determine the initial image frame delay information based on the delay factor and the delay conversion coefficient. For instance, the server can determine the delay factor of the dynamic image frame and the delay conversion coefficient for the image frame delay information based on the delay time of the dynamic image frame. If the delay time is 10 seconds, the delay factor can also be 10 seconds, and the delay conversion coefficient can be 0.01. In this way, the initial image frame delay information can be determined based on the delay factor and the delay conversion coefficient, i.e., 10 / 0.01=1000. The server can perform binary expansion on the initial image frame delay information to obtain low-order delay information and high-order delay information. For example, the server can expand the initial image frame delay information 1000 into binary 1111101000. According to the defined length of the image frame delay information, the lower 8 bits of 1111101000 are used as the low-order delay information, i.e., 11101000, and the higher 8 bits (if less than eight bits, the higher bits can be padded with 0s) are used as the high-order delay information, i.e., 00000011. The server can obtain the fragment sequence number of the data fragment and update the high-order delay information based on the fragment sequence number to obtain the updated high-order delay information. For example, the server can convert the fragment sequence number into binary data corresponding to the high-order delay information, perform a bitwise AND operation with a preset mask value (such as 0x07), and embed the result of the bitwise AND into the high-order delay information to obtain the updated high-order delay information. The server can determine the target image frame delay information based on the low-order delay information and the updated high-order delay information, and obtain the graphics control extension block based on the target image frame delay information. For example, the server can concatenate the low-order delay information and the updated high-order delay information to obtain the target image frame delay information. The server can configure other structures for generating the graphics control extension block, such as display time, image size, alpha channel, etc., and generate the graphics control extension block based on the target image frame delay information, display time, image size, alpha channel, etc.

[0090] In an optional embodiment, for example, the initial image frame delay information is 0x03E8 (1000 centimeters); the server can parse the high-order byte of the initial image frame delay information, i.e., 0x03, which is represented in binary as 00000011, i.e., the high-order delay information. The low-order three bits of the high-order delay information are determined as the mask bits of the fragment identifier, i.e., 011 is used as the mask bits of the fragment identifier. For example, if the fragment identifier is 0x05, which is represented in binary as 00000101, then the server can use the fragment identifier... After performing a bitwise AND operation between the lower three bits of the image frame and a predefined mask (such as 0x07, represented as 00000111 in binary), the result of the bitwise AND operation is embedded in the mask bits. That is, the bitwise AND operation between 00000101 and 00000111 yields 00000101, and the lower three bits are embedded in the mask bits. At this time, the high byte of the delay value is 00000101, i.e., 0x05. Thus, the image frame delay information after the fragment identifier is embedded is obtained, i.e., the target image frame delay information, represented as 0x05E8.

[0091] In an optional embodiment, when the server determines the target image frame delay information based on the fragment sequence number, it can also extract the graphics control extension block in the blank image frame, parse the graphics control extension block to obtain the initial image frame delay information included in the graphics control extension block, and obtain the target image frame delay information based on the fragment sequence number of the data fragment and the initial image frame delay information. Then, the server uses the target image frame delay information to replace the initial image frame delay information to obtain the updated graphics control extension block. Finally, the server uses the updated graphics control extension block to replace the original graphics control extension block in the blank image frame to achieve the embedding of the fragment sequence number.

[0092] In this embodiment, by determining the initial image frame delay information of the graphics control extension block and embedding the fragment sequence number in the high-order delay information of the initial image frame delay information to obtain the updated high-order delay information, and then determining the target image frame delay information based on the updated high-order delay information and low-order delay information, the fragment sequence number can be hidden and transmitted. Furthermore, since the low-order delay information of the initial image frame delay information is not modified, the subsequently generated dynamic image frames will not cause much difference in visual perception, which is beneficial to increasing the concealment of data fragments.

[0093] In one embodiment, the data encryption method further includes:

[0094] Obtain a custom data segment for generating the application extension block, embed the fragment sequence number of the data fragment into the custom data segment to obtain the updated custom data segment; determine the application extension block based on the custom data segment; the application extension block is used to instruct the data receiving end to reassemble the data fragments based on the fragment sequence number embedded in the custom data segment to obtain the data stream.

[0095] The application extension block refers to a data structure used to describe the application extension information of dynamic image frames. In its implementation, the application extension block can be configured with an identifier header, verification information, fragmentation loop information, etc. The custom data segment refers to a custom data area used to generate the application extension block. The content of the custom data segment can be flexibly defined according to business requirements. The updated custom data segment refers to the new data segment formed by embedding data fragments into the original custom data segment.

[0096] For example, the server can obtain a custom data segment used to generate the application extension block, embed the fragment sequence number of the data fragment into the custom data segment, and obtain an updated custom data segment; for example, the server can encapsulate the fragment sequence number and write it into the obtained custom data segment to obtain an updated custom data segment. The server can determine the application extension block based on the custom data segment; for example, the server can further obtain the identifier header, verification information, and fragment cycle information used to generate the application extension block, and encapsulate the identifier header, verification information, fragment cycle information, and the updated custom data segment to obtain the application extension block.

[0097] In an optional embodiment, the fragment looping information encapsulated in the application extension block can be represented by the value of a fragment looping counter to determine the position of each dynamic image frame within the entire GIF image. For example, a fragment looping counter value of 1 indicates that the GIF image loops once, and 2 indicates that the GIF image loops twice. If the GIF image consists of 3 frames, then one loop is the cycle in which the 3 frames are played sequentially once. When the server embeds the fragment sequence number into the custom data segment of the application extension block, it can combine the fragment looping counter to locate the position of the entire data fragment within the GIF image, ensuring that the data receiver can reassemble the data fragments based on the fragment sequence number and the fragment looping counter to obtain the data stream. For example, in a GIF image, there are 3 frames. When the data stream to be embedded is split into 6 data segments, the segment numbers of these 7 data segments are 1, 2, 3, 4, 5, and 6 respectively. During data embedding, the first three data segments can be embedded into the three image frames of the first loop in sequence. At this time, the segment loop counter is 1. In the second loop, the image will be played again in the order of the first to the third frame. The 4th to 6th data segments can be embedded into the three image frames of the second loop in sequence. At this time, the segment loop counter is 2. If a two-dimensional array is constructed using the segment loop counter and the segment number, we can obtain [segment loop counter, segment number]. For example, [2, 1] can represent the first image frame of the second loop, which corresponds to the 4th segment being embedded. In this way, the data receiver can reassemble the data stream according to this order.

[0098] In other embodiments, the server can call the application extension block in the blank image frame, parse the application extension block to obtain a custom data segment within the application extension block, and write the fragment sequence number of the data fragment into the custom data segment to obtain an updated application extension block. The server can replace the original application extension block in the blank image frame with the updated application extension block to achieve data fragment embedding. Specifically, the server can add a custom data segment with an identifier of applicationID=0xFF to the dynamic image frame in the application extension block. The custom data segment has an identifier header of 0x21FF (2 bytes), where 0x21 represents the general identifier of the GIF extension block, and 0xFF represents the flag of the custom application type, used to distinguish it from other extension blocks. Then, the server can embed data allocation in the custom data segment, such as 0x0001 to indicate the dynamic image frame corresponding to the first data fragment, and also to indicate the end of the dynamic image frame. The server can also determine the first 4 bits of the SHA-256 value of the data fragment as the hash value associated with the dynamic image frame based on the SHA-256 method. For example, if the SHA-256 value of the original data fragment is 0xA1B2C3D4E5F6..., then the associated hash value is taken as 0xA1B2C3D4, and the application extension block can be obtained from this.

[0099] In this embodiment, by writing the fragment sequence number of the data fragment into the custom data segment of the application extension, the updated custom data segment is obtained. Then, the application extension block is determined based on the updated custom data segment. This is beneficial for accurately locating each dynamic image frame through the fragment sequence number, so as to achieve accurate transmission of dynamic image frames.

[0100] In one embodiment, step 202, embedding the data fragments into the first pixel layer to obtain the second pixel layer, includes:

[0101] According to the preset target color, at least one pixel index to be replaced is determined from the first pixel layer whose pixel color matches the target color; the target color belongs to the global color table, which is used to provide a unified color reference for the first pixel layer; based on the encrypted fragment obtained by encrypting the data fragment, at least one pixel index to be replaced in the first pixel layer is updated to obtain the second pixel layer.

[0102] Encryption refers to the process of shifting, permuting, or otherwise manipulating the individual bytes of data in a data fragment. For example, each byte in a data fragment can be shifted forward or backward by a fixed number of bits; each byte can be replaced with other bytes according to a certain mapping relationship; or at least some bytes can be added to or subtracted from by a fixed value. Encrypted fragments are data fragments that have undergone encryption processing, serving as ciphertext data for subsequent hiding and transmission within image frames.

[0103] The target color refers to the color standard used in the first pixel layer to select the pixel index to be replaced. The target color can be a single color value or a color range. By setting a target color, pixel indices that meet the corresponding color conditions from numerous pixel indices in the first pixel layer can be selected as the target color to hide the data in the encrypted segments. In practice, when determining the target color, a color with fewer uses in the global color table can be chosen. Alternatively, a statistical analysis of the colors corresponding to each pixel index to be replaced in the first pixel layer can be performed to select the less frequently used color as the target color. The target color can also be obtained by combining the colors of pixel indices corresponding to less frequently noticed areas in the first pixel layer, such as border areas. The pixel index to be replaced refers to the pixel index in the first pixel layer whose color matches the target color. The pixel index to be replaced can be used to hide the data in the encrypted segments.

[0104] For example, the server can determine one or more target colors based on a pre-defined range. For instance, the server can select a less frequently used color from a global color table based on historical statistics; alternatively, it can perform real-time statistics on the colors corresponding to pixel indices in the selected first pixel layer and select the color corresponding to the pixel index of a less frequently used or less-discussed region as the target color. The server can determine at least one pixel index from the first pixel layer that matches the preset target color to be replaced. For example, the server can iterate through the pixel indices in the pixel index combination corresponding to the first pixel layer, determine the pixel color corresponding to each pixel index, and determine whether the pixel color belongs to the target color. If it does, the pixel index is determined as the pixel index to be replaced. The server can encrypt the targeted data fragments to obtain encrypted fragments. For example, the server can perform shifting, permutation, or other operations on the targeted data fragments to obtain encrypted fragments. For example, taking 0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x00, ..., 0x00 as an example, the server can shift the entire sequence two positions to the right and add the last two positions to the beginning of the sequence, resulting in 0x00, 0x00, 0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x00, ..., 0x00, which is the encrypted fragment. Based on the encrypted fragment, the server can update at least one pixel index to be replaced in the first pixel layer to obtain the second pixel layer.

[0105] In this embodiment, encrypted data segments are obtained by encrypting them. Based on a preset target color, the pixel index to be replaced in the first pixel layer is determined. Then, the encrypted data segments are combined with the pixel index to be replaced to update the second pixel layer. This can be achieved through multi-layer encryption. The first layer of encryption involves shifting and permuting each data segment to encrypt it, which can obfuscate each data segment and increase the strength of data encryption. At the same time, the second layer of encryption based on the pixel layer can further embed the encrypted data segments, which can effectively increase the concealment of the data and thus increase the difficulty of data cracking, ensuring the confidentiality of the data before transmission.

[0106] In one embodiment, based on the encrypted fragments obtained by encrypting the data fragments, at least one pixel index to be replaced is updated to obtain a second pixel layer, including:

[0107] Each byte in the encrypted fragment is expanded into binary to obtain a binary data sequence. The binary data sequence is then divided according to a preset data partitioning condition to obtain at least one data block. The number of data blocks is the same as the number of pixel indices to be replaced. Each data block includes at least one binary unit of data. Based on the binary unit of data corresponding to the data block, the index offset value of the pixel index to be replaced is determined. The pixel index to be replaced in the first pixel layer is updated using the index offset value to obtain the second pixel layer.

[0108] Expanding the bytes in the encrypted fragment into binary form means representing each byte in binary format. For example, the "H" in "Hello" is represented as 0x48 in hexadecimal. Expanding this byte into binary gives us 01001000. Thus, expanding the bytes in the encrypted fragment into binary results in a binary data sequence composed of 0s and 1s. Each bit in this binary data sequence has a specific position. For example, "He" is represented as 0x48 and 0x65 in hexadecimal, and its expanded binary data sequence is 01001000 01100101. Based on this, a single binary bit (or unit of data) in the binary data sequence can be considered a unit of data. Dividing the binary data sequence according to preset data partitioning conditions yields at least one data block. Each data block can contain a preset number of units of data, which can be bytes, bits, etc. For example, for the binary data sequence 01001000 01100101, if it is divided into 3 binary bits, we can get 5 data blocks, namely 010, 010, 000, 110, 010, 100 (if the last data block is less than 3 bits, it can be padded with 0). If it is divided into 3 binary bits, we can get 4 data blocks, namely 0100, 1000, 0110, 0101.

[0109] A data block is a data structure used to update the index of the pixel to be replaced. The index offset is a value obtained through a specific calculation or conversion method based on the unit data contained within each data block. The index offset can be used to update the index of the pixel to be replaced. In practice, since the index of the pixel to be replaced is constructed using decimal data, while the data block is binary data divided from a binary data sequence, the index offset can be determined by first converting the data block to decimal. For example, if a data block is 010, its decimal value is 2, and therefore the index offset is 2.

[0110] For example, the server can expand each byte in the encrypted fragment into binary data to obtain a binary data sequence. This binary data sequence can then be divided according to preset data partitioning conditions to obtain at least one data block. For instance, the server can obtain the hexadecimal sequence of each encrypted fragment. For each byte in the hexadecimal sequence, it can be converted into binary data and sequentially combined to obtain another binary data sequence. The server can determine preset data partitioning conditions, such as a preset number of units of data, and then partition the binary data sequence according to this preset number to obtain at least one data block. When determining the number of partitions, the server can consider both the size of the encrypted fragments and the security requirements of the data. For example, for larger fragments, each data block can include more units of data to improve the efficiency of subsequent steganography. Conversely, for data with higher security requirements, each data block can include fewer units of data to make the encrypted fragments more dispersed and thus improve the security of data hiding.

[0111] The server can determine the index offset value of the pixel index to be replaced based on the binary unit data corresponding to the data block. For example, the server can determine the unit data corresponding to each data block separately, and convert each data block into decimal representation using the binary-to-decimal method to obtain the index offset value.

[0112] The server can update the index of the pixel to be replaced using the index offset value to obtain the second pixel layer. For example, the server can superimpose the index offset values ​​of each data block onto the index of the pixel to be replaced to update the index of the pixel to be replaced and obtain the second pixel layer. In specific implementation, if the index offset value of a data block is 2, and the index value of the pixel to be replaced corresponding to this data block is 16, then the index value of the pixel to be replaced is updated using the index offset value of the data block 2, and the updated pixel index is 18, thus obtaining the second pixel layer.

[0113] In an optional embodiment, when determining the pixel index to be replaced, the server can expand each pixel index in the first pixel layer into a one-dimensional array in row-major order. For example, the server can arrange the pixel indices in the first pixel layer in row-major order "from left to right, from top to bottom" to obtain a one-dimensional array. Then, the server can perform matrix transpose on the obtained one-dimensional array to convert the row-major pixel index arrangement into a column-major arrangement. Afterward, according to the transposed pixel index order, the server can concentrate the pixel indices in non-critical areas in the transposed pixel index sequence or matrix. Subsequently, when steganographically writing the encrypted fragments, the server can preferentially select the pixel indices located in non-critical areas (such as background or gradient areas) after transposition as the pixel index to be replaced.

[0114] In some optional embodiments, when determining the preset number of unit data, the server can consider the characteristics of the data in the encrypted fragment. For example, if a byte contains 8 bits, the preset number can be divided according to the number of bytes that are not divisible by 8. This makes the data in each byte of the encrypted fragment more dispersed; for example, a data block may contain binary numbers from two bytes. In other embodiments, the server can determine the preset number using a non-fixed or non-uniform method. In specific implementation, the server can dynamically determine the number of unit data divisions based on the data content of the encrypted fragment. For example, the number of unit data contained in each data block can be determined according to a geometric sequence, an odd sequence, an even sequence, etc. For instance, when dividing according to an odd sequence, the first data block may include 1 unit data (1 bit), the second data block may include 3 units of data, the third data block may include 5 units of data, and so on. For example, servers can divide data blocks according to specific patterns or flags in the binary sequence. For instance, when a specific binary sequence (such as 0000) is encountered, it can be used as the boundary of the data block to increase the diversity of data block division.

[0115] In some other embodiments, the number of data blocks may not be the same as the number of pixel indices to be replaced. The server determines the target data block from at least one data block to update the pixel indices to be replaced. For example, the server can obtain the pixel indices to be replaced, such as 16, 23, etc., from a pre-built pixel index mapping table. Then, the server can determine the data block corresponding to each pixel index to be replaced in a one-to-one correspondence according to the arrangement order of the data blocks and the arrangement order of the pixel indices to be replaced, so as to obtain the target data block.

[0116] In other embodiments, when the number of pixel indices to be replaced is less than the number of data blocks, the server can first use the data blocks corresponding to the number of pixel indices to be replaced to update the pixel indices to be replaced. Then, the remaining data blocks can reuse the already updated pixel indices to be replaced to update the updated pixel indices to be replaced a second time, until all data blocks are embedded in the pixel indices. For example, when there are 20 pixel indices to be replaced and 30 data blocks, for the first 20 data blocks, they can be updated one-to-one with the pixel indices to be replaced or according to a certain correspondence. For the remaining 10 data blocks, pixel indices that meet the preset target color can be determined again from the pixel indices to be replaced after the first round of updates as the pixel indices to be replaced in the second round of updates. Based on the remaining 10 data blocks, the corresponding pixel indices to be replaced are determined and updated. It is only necessary to record the order of updating and reusing the pixel indices to be replaced during the update process. If there are still remaining data blocks that are not completely embedded after the second round of updates, multiple rounds of updates can be performed until all data blocks are completely embedded in the pixel indices. In multiple rounds of updates, if there are redundant pixel indices in the data block and no matching conditions are found, the range of the target color can be further expanded to identify more pixel indices to be replaced, or the original pixel indices to be replaced can be rounded up. For example, if the index range of the target color is 16 to 31, and the index value of a pixel to be replaced is 30, and the index offset of the corresponding target data block is 3, the resulting pixel index to be replaced is 33, which exceeds the index range of the target color. In this case, the pixel index can be rounded up to 16, that is, the part exceeding 31 can be re-added starting from 16, so that the final pixel index to be replaced is 33-31+16=18.

[0117] In this embodiment, by expanding the encrypted fragment bytes into a binary data sequence and dividing the binary data sequence into data blocks according to a preset number of unit data, the binary data sequence can enhance the flexibility and versatility of data processing. The data blocks are beneficial to improving data processing efficiency and can better adapt to different encryption methods, ensuring data security and effective utilization. At the same time, it ensures that the data blocks can adapt to the update process of the pixel index to be replaced. Furthermore, by determining the data blocks and their index offset values, and using the index offset values ​​to update the pixel index to be replaced, a second pixel layer is obtained. The pixel index of the first pixel layer can be adjusted, which can effectively embed each data block of the data fragment into the first pixel layer to increase the concealment of the data and ensure data security.

[0118] In one embodiment, the data encryption method further includes:

[0119] Redundancy verification is performed on the target data fragment to obtain the verified data fragment; based on the verified data fragment, the encoded data segment is determined and encoded to obtain the encoded data fragment; the bytes in the encoded data fragment are alternately shifted and swapped to obtain the encrypted fragment corresponding to the target data fragment.

[0120] Redundancy check is a process used to detect whether data has been tampered with or corrupted during transmission or storage. Redundancy check adds extra redundancy information (such as a checksum) to the original data fragments. When data changes, this redundancy information can be used to detect errors. The data receiver can generate a checksum using redundancy check and send it synchronously with the encrypted data. After receiving the encrypted data, the receiver will recalculate a checksum using the same redundancy check method. If the checksum calculated locally by the receiver matches the received checksum, the data has not been tampered with; otherwise, the data has been tampered with. Redundancy check methods can include, but are not limited to, parity check and cyclic redundancy check (CRC). The checked data fragment refers to the data fragment after the redundancy check operation, which contains the original data fragment and the added redundancy check information (i.e., the checksum).

[0121] An encoded data segment refers to a portion of data determined from the verified data fragments. For example, the encoded data segment can be extracted from the verified data fragments with a fixed length, or it can be dynamically determined based on data characteristics or a specific algorithm. In practical implementation, the purpose of encoding is primarily to enhance the data's anti-interference capability. Therefore, the obtained checksum can be encoded. Taking the 32-bit checksum obtained in the example above, the lower 16 bits of the 32-bit checksum can be used as the encoded data segment for encoding, to be used by the data receiver to verify the integrity of the data. The encoded data fragment refers to the result obtained after encoding the encoded data segment. Encoding methods can include, but are not limited to, one or more of Base64 encoding, hexadecimal encoding, Huffman coding, and Hamming encoding. Encoding is the process of converting data from one representation form to another.

[0122] Shifting and transposing refers to the process of rearranging and replacing the positions of individual bytes in an encoded data fragment. For example, moving each byte in a data fragment to a new position changes the original order of the data. Alternatively, replacing each byte in a data fragment according to a certain mapping relationship yields new byte data, which can then be restored based on the mapping relationship. In practice, the encoded data fragment can be shifted and replaced directly byte-by-byte, or the data fragments can be expanded into binary form and then the binary bits can be shifted and replaced. Taking bytes as an example, assuming an encoded data fragment is "ABCDEF", using a simple shifting and transposing rule, moving each byte two positions to the right (circular shift), the shifted data fragment becomes "EFABCD". Similarly, using a substitution operation, replacing AB with 03, the substituted data fragment becomes "03CDEF".

[0123] In practical implementation, shifting and permutation can be achieved using at least one of the following methods: column shifting permutation, box permutation, etc. Column shifting permutation arranges the data in the data slices according to columns and then shifts the columns according to certain rules. For example, the bytes in the data slices can be used to construct a matrix, and a column in the matrix can be moved up or down several rows, or the order of the columns can be rearranged according to a specific order to change the positional relationship of the data. This increases the randomness and complexity of the data, improving encryption security. Box permutation can replace bytes in the data slices using non-linear permutations. For example, a predefined replacement table can map the input bytes or bit combinations to another byte or bit combination to further obfuscate the bit pattern of the data, making the encrypted data more random and improving encryption security.

[0124] For example, the server can perform redundancy checks on the targeted data fragments to obtain the checked data fragments. Taking cyclic redundancy check (CRC-32) as an example, the server can perform CRC-32 checks on the data fragments, generate a 32-bit identification check code, and combine this identification check code with the targeted data fragments to obtain the checked data fragments. Then, based on the checked data fragments, the server can determine the encoded data segments and encode the encoded data segments to obtain the encoded data fragments. For example, the server can determine the identification check code in the checked data fragments, identify the lower 16 bits of the identification check code as the encoded data segment, and encode the encoded data segment using Hamming encoding to obtain the encoded data fragments. Further redundancy check codes are incorporated into the encoded data fragments to further enhance their anti-interference capabilities. Finally, the server can alternately shift and / or permutate each byte in the encoded data fragment to obtain the encrypted fragment corresponding to the data fragment. For example, the server can perform column shift permutation on the bytes in the encoded data fragment except for the checksum, and then perform box permutation on the result of the column shift permutation to obtain the encrypted fragment. Alternatively, the server can also alternately perform column shift permutation and box permutation once or multiple times in a certain order and number of times to increase the encryption strength.

[0125] In an optional embodiment, after obtaining the encrypted fragments, the server can inject timestamps into each encrypted fragment to determine the time correspondence between each encrypted fragment and the target image frame. Specifically, the server can insert a four-byte UNIX timestamp into the block header of the encrypted fragment to identify its time flow information. In this embodiment, by performing redundancy checks on the data fragments, determining and encoding coded data segments based on the checked fragments, and then alternately shifting and permuting the encoded data fragments, the anti-interference capability of the data can be improved through scrambling the byte order and substitution operations. This effectively increases the difficulty of data cracking, strengthens the encryption effect, and effectively ensures data security.

[0126] In one embodiment, based on the verified data fragments, coded data segments are determined, and the coded data segments are encoded to obtain encoded data fragments, including:

[0127] Perform at least one redundant encoding on the encoded data segment to obtain the corresponding redundancy check code for each encoded data segment after at least one redundant encoding; based on the redundancy check code and the reserved data segment, obtain the encoded data fragment; the reserved data segment is determined based on the checked data fragment and the encoded data segment.

[0128] Redundancy coding refers to an encoding method that adds extra information (redundant information) to the original data. By adding redundant information, errors can be detected at the data receiving end during transmission or storage. Redundancy check codes are the extra information generated after redundancy coding of the encoded data segments. Reserved data segments refer to a portion of data determined based on the checked data fragments and the encoded data segments. In practice, reserved data segments are usually data from the original data fragments. During the encoding process, reserved data segments do not directly participate in redundancy coding operations. When determining reserved data segments, they can be the remaining portion after removing the encoded data segments from the checked data fragments, or a portion selected from the checked data fragments according to a specific algorithm.

[0129] For example, the server can perform at least one redundant encoding on the encoded data segment to obtain the corresponding redundancy check code for each segment after at least one redundant encoding. For instance, the server can use Hamming encoding to perform redundant encoding on the encoded data segment. Specifically, the server can perform two rounds of Hamming encoding, generating an 11-bit redundancy check code in each round. The server can determine the retained data segment based on the verified data fragments and the encoded data segments. That is, the server can remove the encoded data segment from the verified data fragments to obtain the retained data segment. Then, the server can combine the redundancy check code with the retained data segment to obtain the encoded data fragment.

[0130] In this embodiment, the encoded data segment is redundantly encoded at least once to generate a corresponding redundant check code. Then, the encoded data fragments are obtained based on the redundant check code and the reserved data segment. By encoding multiple times, the complexity of the check code can be increased, which is beneficial to increasing the accuracy of data integrity verification in the subsequent decryption process.

[0131] In one embodiment, the data encryption method further includes:

[0132] The dynamic image frame is sent to the data receiving end in real time, so that the data receiving end can decrypt the dynamic image frame based on the received pixel index mapping table to obtain data fragments.

[0133] In this context, a data receiver refers to a device, system, or program responsible for receiving data sent from a data sender (or server) during network communication or data transmission. A data receiver can be a computer, server, mobile device, or any other device or apparatus capable of receiving and processing data. When a data receiver receives a dynamic image frame transmitted from a data sender, it can parse and decrypt the frame to obtain the decrypted data, i.e., the byte data from the original data stream. During decryption, the data receiver can also verify the integrity of the decrypted data. For example, it can generate a verification code based on the byte data in the recovered data stream, using the redundancy check and redundancy encoding employed during encryption. This verification code is then compared with the redundancy check code carried in the data encryption result to determine whether the data has been tampered with or corrupted during transmission.

[0134] For example, the server can determine the data transmission protocol with the data receiver and send dynamic image frames to the data receiver in real time based on the data transmission protocol, so as to instruct the data receiver to decrypt the dynamic image frames based on the received pixel index mapping table to obtain data fragments.

[0135] In an optional embodiment, the server can continuously send motion image frames to the data receiver using chunked transfer encoding. For example, the server can continuously send motion image frames via an HTTP persistent connection. During transmission, the server can determine the Frame Interval Control Protocol (FCP), whose response header includes the X-GIF-FrameInterval field, to control the transmission interval of each motion image frame. The server can then continuously send motion image frames to the data receiver based on the FCP.

[0136] In this embodiment, by sending dynamic image frames to the data receiving end, the data receiving end can use the pixel index mapping table to decrypt the data, thus enabling encrypted data transmission.

[0137] In one embodiment, the data encryption method further includes:

[0138] The receiving end receives verification information based on the received dynamic image frames; if the verification information indicates a data transmission anomaly, it determines the dynamic image frame associated with the abnormal data based on the verification information and recovers the dynamic image frame associated with the abnormal data from the buffer; based on the recovered dynamic image frame, it re-obtains the dynamic image frame for the data fragment and sends it to the receiving end.

[0139] The verification information refers to the information generated and returned by the data receiving end after verifying the received dynamic image frame. The verification process may include, but is not limited to, data integrity and correctness checks. The data sending end (i.e., the server) can decide whether to take retransmission or other measures to ensure reliable data transmission based on the verification information. When the verification information indicates that an anomaly occurred during data transmission, such as data tampering, corruption, or loss, the data sending end can retransmit the abnormal data to restore its correctness and integrity. The dynamic image frame associated with the abnormal data is an encrypted image frame corresponding to the data portion involved in the data transmission anomaly. When a data transmission anomaly occurs, it is necessary to identify the dynamic image frame corresponding to the abnormal data so that the data sending end can perform targeted recovery operations on the abnormal dynamic image frame, avoiding unnecessary retransmissions or processing.

[0140] A buffer is an area used for temporary data storage. During data transmission and processing, a buffer acts as a buffer, balancing the speed difference between data sending and receiving, and preventing data loss or untimely processing. A buffer can be used to store backup data of animated image frames sent by the data sender. When a data transmission anomaly occurs, the previously stored backup data of animated image frames can be retrieved from the buffer to restore the abnormal data, ensuring data integrity and continuity. In specific implementations, the server can maintain a circular buffer of a preset size, such as a circular buffer with 16 frames. This means that the circular buffer can store a maximum of 16 animated image frames that have been sent to the data receiver. When the buffer is full, the most recently sent animated image frame can overwrite the first stored animated image frame, thus achieving breakpoint resumption.

[0141] For example, after receiving a dynamic image frame, the data receiving end can decrypt the dynamic image frame, segment the decrypted data to determine the corresponding checksum, compare the checksum with the redundant checksum carried in the dynamic image frame, generate corresponding verification information based on the comparison result, and return the verification information to the server at preset time intervals. After receiving the verification information returned by the data receiving end, the server can determine whether there is a data transmission anomaly based on the verification information. In some other embodiments, the data verification process can also be implemented on the server side, that is, the data receiving end can return the checksum as verification information to the server, and the server can compare the verification code sent by the data receiving end with the redundant checksum on the local end to determine whether the data transmission is abnormal. If the verification information indicates that the data transmission is abnormal, the server can determine the dynamic image frame associated with the abnormal data based on the verification information, that is, the server can determine the dynamic image frame associated with the abnormal data based on the identification information corresponding to the abnormal dynamic image frame in the verification information. The server can recover the dynamic image frame associated with the abnormal data from the buffer based on the identification information (such as the identification header) of the dynamic image frame associated with the abnormal data. Finally, the server can re-obtain the dynamic image frames for the data fragments based on the recovered dynamic image frames and send them to the data receiving end. For example, after recovering the dynamic image frames associated with the abnormal data from the buffer, the server can directly resend the recovered dynamic image frames to the data receiving end, or it can re-encrypt the data corresponding to the dynamic image frames according to the process in the above embodiments and then send them to ensure that the receiving end can receive the correct data.

[0142] In this embodiment, by receiving verification information from the data receiver and resending the corresponding dynamic image frame from the buffer in case of data transmission anomalies, the integrity and accuracy of data transmission can be guaranteed. Furthermore, it can effectively cope with transmission failures, which is conducive to improving the reliability and stability of data transmission and ensuring that the data can reach the data receiver safely and accurately.

[0143] In one embodiment, such as Figure 4 As shown, a data decryption method is provided, which can be applied to... Figure 1 Taking server 102 as an example, which is deployed at the data receiving end, this method can also be applied to terminal 101 and systems including terminal 101 and server 102, through interaction between terminal 101 and server 102. The method in this embodiment includes steps 401 to 403. Wherein:

[0144] Step 401: Receive the dynamic image frame sent in real time by the data sending end, and extract the second pixel layer and segmentation marker included in the dynamic image frame. The segmentation marker is the segmentation identifier of different image frames.

[0145] In contrast to the data receiver, the data sender refers to the device, system, or program responsible for generating or sending data during network communication or data transmission. Similar to the data receiver, the data sender can be any device or apparatus capable of receiving and processing data, such as a computer, server, or mobile device.

[0146] For example, after the data sending end encrypts the data stream based on the data communication request to obtain a dynamic image frame, the data sending end can send the dynamic image frame to the data receiving end (or the server of the data receiving end) in real time. The server can receive the dynamic image frame sent by the data sending end in real time and extract the second pixel layer and segmentation marker included in the dynamic image frame according to the transmission order.

[0147] Step 402: Invoke the first pixel layer that matches the second pixel layer.

[0148] The first pixel layer, which matches the second pixel layer, refers to the image layer before data fragment embedding. This first pixel layer is dynamically generated based on a pre-stored pixel index mapping table, which defines the pixel index arrangement rules for the first pixel layer.

[0149] For example, the server can parse a dynamic image frame to obtain the second pixel layer, segmentation marker, application extension block, and graphics control extension block of the dynamic image frame. It can then parse the application extension block to obtain segmentation loop information and the graphics control extension block to obtain image frame delay information. Afterward, the server can parse the segmentation loop information to obtain the loop number of the image frame. The server can also extract the high-order delay information of the image frame delay information and reconstruct the segment number of the data segment based on a preset mask value. The server can call the first pixel layer that matches the second pixel layer; for example, the server can call the first pixel layer that matches the second pixel layer based on the loop number and the segment number.

[0150] Step 403: Based on the difference and pixel index mapping table between the second pixel layer and the first pixel layer that matches the second pixel layer, extract the data fragments embedded in the second pixel layer.

[0151] The difference between the matching first pixel layer and the second pixel layer refers to the difference between the pixel index in the second pixel layer and the pixel index of the corresponding pixel position in the first pixel layer.

[0152] For example, the server can extract the data fragments embedded in the second pixel layer based on the difference between the second pixel layer and the first pixel layer that matches the second pixel layer and the pixel index mapping table. For example, the server determines the difference between the second pixel layer and the first pixel layer that matches the second pixel layer; then, the server can extract each pixel index in the second pixel layer and each pixel index in the first pixel layer that matches the second pixel layer, and calculate the difference between the pixel indices in the two pixel layers at the same pixel position. Following the reverse operation of the encryption process, the server first restores the index offset value of each data block based on each difference, then converts each index offset value into binary to obtain each data block, and then combines the data blocks according to the pixel index mapping table to obtain the corresponding data fragments.

[0153] In an optional embodiment, when the server obtains data fragments based on each data block, the server can first combine the data blocks to obtain encrypted fragments, and then perform the encrypted fragments in reverse operation of box permutation and column shift to obtain data fragments.

[0154] In the aforementioned data decryption method, a second pixel layer and segmentation markers are extracted from the dynamic image frames sent in real time by the data sending end. The segmentation markers serve as segmentation identifiers for different image frames. A first pixel layer matching the second pixel layer is invoked. This first pixel layer is dynamically generated based on a pre-stored pixel index mapping table, which defines the pixel index arrangement rules for the first pixel layer. Based on the differences between the second pixel layer and the matching first pixel layer, and the pixel index mapping table, data fragments embedded in the second pixel layer are extracted. By receiving dynamic image frames and extracting the second pixel layer and segmentation markers from them, and invoking the first pixel layer dynamically generated using the pre-stored pixel index mapping table to match the second pixel layer, the differences between the first and second pixel layers can be compared to accurately extract the data fragments embedded in the second pixel layer. This effectively ensures the accuracy of data extraction. The entire decryption process is efficient and reliable, reducing the risk of data errors or loss during decryption, thereby improving the stability and security of data transmission and processing.

[0155] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages in other steps. It is understood that the steps in different embodiments can be freely combined as needed, and all non-contradictory solutions formed by such combinations are within the scope of protection of this application.

[0156] Based on the same inventive concept, this application also provides a data encryption device for implementing the data encryption method described above. The solution provided by this device is similar to the implementation described in the above method; therefore, the specific limitations in one or more data encryption device embodiments provided below can be found in the limitations of the data encryption method described above, and will not be repeated here.

[0157] In one exemplary embodiment, such as Figure 5 As shown, a data encryption device is provided, including: a data segmentation module 501, a pixel layer generation module 502, and an image frame generation module 503, wherein:

[0158] The data segmentation module 501 is used to segment the real-time input data stream into at least one data segment according to a preset length.

[0159] The pixel layer generation module 502 is used to call the first pixel layer used to generate dynamic image frames, embed data slices into the first pixel layer, and obtain the second pixel layer; the first pixel layer is dynamically generated according to the pre-stored pixel index mapping table, which is used to define the pixel index arrangement rules of the first pixel layer;

[0160] The image frame generation module 503 is used to generate encrypted dynamic image frames based on the second pixel layer. The dynamic image frames include segmentation markers, which are the segmentation identifiers for different image frames.

[0161] In an optional embodiment, the pixel layer generation module 502 is further configured to obtain a pixel index mapping table for a dynamic image frame; call the pixel array used to generate the dynamic image frame, and determine a combination of pixel indices for the pixel array from the pixel index mapping table; for each pixel in the pixel array, determine the pixel index of the pixel in the pixel array according to the position of the pixel in the pixel array from the combination of pixel indices; and obtain the first pixel layer according to the pixel index.

[0162] In an optional embodiment, the pixel layer generation module 502 is further configured to determine at least one pixel index to be replaced from the first pixel layer according to a preset target color; the target color belongs to a global color table; the global color table is used to provide a unified color reference for the first pixel layer; and based on the encrypted fragment obtained by encrypting the data fragment, at least one pixel index to be replaced in the first pixel layer is updated to obtain the second pixel layer.

[0163] In an optional embodiment, the pixel layer generation module 502 is further configured to expand each byte in the encrypted fragment according to binary to obtain a binary data sequence, divide the binary data sequence according to a preset data partitioning condition to obtain at least one data block, the number of data blocks being consistent with the number of pixel indices to be replaced, and the data block including at least one binary unit data; determine the index offset value of the pixel index to be replaced according to the binary unit data corresponding to the data block, and update the pixel index to be replaced in the first pixel layer through the index offset value to obtain the second pixel layer.

[0164] In an optional embodiment, the pixel layer generation module 502 is further configured to perform redundancy verification on the target data segment to obtain the verified data segment; based on the verified data segment, determine the encoded data segment and encode the encoded data segment to obtain the encoded data segment; and alternately shift and swap each byte in the encoded data segment to obtain the encrypted segment corresponding to the target data segment.

[0165] In an optional embodiment, the pixel layer generation module 502 is further configured to perform at least one redundant encoding on the encoded data segment to obtain the redundancy check code corresponding to each encoded data segment after at least one redundant encoding; based on the redundancy check code and the reserved data segment, the encoded data fragment is obtained; the reserved data segment is determined based on the checked data fragment and the encoded data segment.

[0166] In an optional embodiment, the data encryption device further includes an extension block generation module for obtaining a graphics control extension block based on image frame delay information; the image frame delay information is determined according to the fragment number of the data fragment and the delay factor of the dynamic image frame; the delay factor is determined according to the delay time of the dynamic image frame. Based on the second pixel layer and the graphics control extension block, a dynamic image frame after data fragment encryption is generated.

[0167] In an optional embodiment, the extension block generation module is further configured to determine the delay factor of the dynamic image frame and the delay conversion coefficient for the image frame delay information; determine the initial image frame delay information of the dynamic image frame based on the delay factor and the delay conversion coefficient; perform binary expansion on the initial image frame delay information to obtain low-order delay information and high-order delay information; obtain the fragment number of the data fragment; update the high-order delay information based on the fragment number to obtain the updated high-order delay information; determine the target image frame delay information based on the low-order delay information and the updated high-order delay information; and obtain the graphics control extension block based on the target image frame delay information.

[0168] In an optional embodiment, the extension block generation module is further configured to obtain a custom data segment for generating the application extension block, embed the fragment sequence number of the data fragment into the custom data segment to obtain an updated custom data segment; determine the application extension block based on the custom data segment; the application extension block is used to instruct the data receiving end to reassemble the data fragments based on the fragment sequence number embedded in the custom data segment to obtain a data stream.

[0169] In an optional embodiment, the data encryption device further includes a data transmission module for transmitting dynamic image frames to a data receiver in real time, so as to instruct the data receiver to decrypt the dynamic image frames based on the received pixel index mapping table to obtain data fragments.

[0170] In an optional embodiment, the data sending module is further configured to receive verification information returned by the data receiving end based on the received dynamic image frame; if the verification information indicates that the data transmission is abnormal, determine the dynamic image frame associated with the abnormal data based on the verification information, and recover the dynamic image frame associated with the abnormal data from the buffer; and obtain the dynamic image frame for the data fragment based on the recovered dynamic image frame and send it to the data receiving end.

[0171] Each module in the aforementioned data encryption device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.

[0172] Based on the same inventive concept, this application also provides a data decryption apparatus for implementing the data decryption method described above. The solution provided by this apparatus is similar to the implementation described in the above method; therefore, the specific limitations in one or more data decryption apparatus embodiments provided below can be found in the limitations of the data decryption method described above, and will not be repeated here.

[0173] In one exemplary embodiment, such as Figure 6 As shown, a data decryption device is provided, including: a pixel layer extraction module 601, a pixel layer retrieval module 602, and a data fragment extraction module 603, wherein:

[0174] The pixel layer extraction module 601 is used to receive dynamic image frames sent in real time by the data sending end, and extract the second pixel layer and segmentation markers included in the dynamic image frames; the segmentation markers are the segmentation identifiers of different image frames.

[0175] The pixel layer calling module 602 is used to call the first pixel layer that matches the second pixel layer. The first pixel layer is dynamically generated according to the pre-stored pixel index mapping table, which is used to define the pixel index arrangement rules of the first pixel layer.

[0176] The data fragment extraction module 603 is used to extract the data fragments embedded in the second pixel layer based on the difference and pixel index mapping table between the second pixel layer and the first pixel layer that matches the second pixel layer.

[0177] Each module in the aforementioned data decryption device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in the processor of a computer device in hardware form or independent of it, or stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to each module.

[0178] In one embodiment, a data transmission system is provided, comprising:

[0179] The data sending end is used to divide the real-time input data stream into a data slice according to a preset length; it calls the first pixel layer used to generate dynamic image frames, embeds the data slice into the first pixel layer, and obtains the second pixel layer; the first pixel layer is dynamically generated according to a pre-stored pixel index mapping table, which is used to define the pixel index arrangement rules of the first pixel layer; based on the second pixel layer, it generates a dynamic image frame after encrypting the data slice, and sends the dynamic image frame to the data receiving end in real time. The dynamic image frame includes a segmentation marker, which is the segmentation identifier for different image frames;

[0180] The data receiving end receives dynamic image frames sent in real time by the data sending end, extracts the second pixel layer and segmentation markers included in the dynamic image frames; the segmentation markers are the segmentation identifiers for different image frames; it calls the first pixel layer that matches the second pixel layer, which is dynamically generated according to a pre-stored pixel index mapping table, which is used to define the pixel index arrangement rules of the first pixel layer; based on the differences between the second pixel layer and the first pixel layer that matches the second pixel layer and the pixel index mapping table, it extracts the data fragments embedded in the second pixel layer.

[0181] In one exemplary embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 7 As shown, this computer device includes a processor, memory, input / output interfaces (I / O), and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operating system and computer programs stored in the non-volatile storage media. The database stores data such as data fragments, a global color table, a pixel index mapping table, and target colors. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communication with external terminals via a network connection. When executed by the processor, the computer program implements a data encryption method.

[0182] Those skilled in the art will understand that Figure 7 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0183] In one exemplary embodiment, a computer device is provided, including a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the data encryption method and / or data decryption method described in the above embodiments.

[0184] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the data encryption method and / or data decryption method described in the above embodiments.

[0185] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the data encryption method and / or data decryption method described above.

[0186] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.

[0187] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, artificial intelligence (AI) processors, etc., and are not limited to these.

[0188] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0189] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A data encryption method characterized by, The method comprises: cutting a real-time input data stream into a data segment according to a preset length; calling a first pixel layer for generating a dynamic image frame, embedding the data segment into the first pixel layer to obtain a second pixel layer; the first pixel layer is dynamically generated according to a pre-stored pixel index mapping table, and the pixel index mapping table is used to define a pixel index arrangement rule of the first pixel layer; based on the second pixel layer, generating a dynamic image frame after encryption for the data segment, wherein the dynamic image frame comprises a segment marker, and the segment marker is a segmentation identifier of different image frames.

2. The method of claim 1, wherein, The method further comprises: obtaining a graphics control extension block based on image frame delay information; the image frame delay information is determined according to a segment number of the data segment and a delay factor of the dynamic image frame; the delay factor is determined according to a delay time of the dynamic image frame; the method further comprises: based on the second pixel layer and the graphics control extension block, generating a dynamic image frame after encryption for the data segment in the data stream.

3. The method of claim 2, wherein, The method further comprises: determining a delay factor of the dynamic image frame and a delay conversion coefficient for the image frame delay information, determining initial image frame delay information of the dynamic image frame based on the delay factor and the delay conversion coefficient; performing binary expansion on the initial image frame delay information to obtain low-bit delay information and high-bit delay information; obtaining a segment number of the data segment, updating the high-bit delay information based on the segment number to obtain updated high-bit delay information; determining target image frame delay information according to the low-bit delay information and the updated high-bit delay information, and obtaining a graphics control extension block based on the target image frame delay information.

4. The method of claim 1, wherein, The method further comprises: obtaining a custom data segment for generating an application extension block, embedding a segment number of the data segment into the custom data segment to obtain an updated custom data segment; determining an application extension block based on the custom data segment; the application extension block is used to instruct a data receiving end to recombine the data segment based on the segment number embedded in the custom data segment to obtain the data stream.

5. The method of claim 1, wherein, The method further comprises: determining at least one to-be-replaced pixel index with a pixel color matching a target color from the first pixel layer according to the preset target color; the target color belongs to a global color table, and the global color table is used to provide a unified color reference for the first pixel layer; updating at least one to-be-replaced pixel index in the first pixel layer based on an encrypted segment obtained by encrypting the data segment to obtain a second pixel layer.

6. The method of claim 5, wherein, The method further comprises: updating at least one to-be-replaced pixel index in the first pixel layer based on an encrypted segment obtained by encrypting the data segment to obtain a second pixel layer. Unfold each byte in the encrypted fragment in binary to obtain a binary data sequence, divide the binary data sequence according to a preset data division condition to obtain at least one data block, the number of data blocks being consistent with the number of pixel indexes to be replaced, and the data block including at least one binary unit data; According to the binary unit data corresponding to the data block, determine the index offset value of the pixel index to be replaced, update the pixel index to be replaced in the first pixel layer through the index offset value, and obtain the second pixel layer.

7. The method of claim 1, wherein, The method further comprises: performing redundancy checking on the data fragment to obtain a checked data fragment; based on the checked data fragment, determine an encoded data segment, and encode the encoded data segment to obtain an encoded data fragment; alternately shift each byte in the encoded data fragment to obtain an encrypted fragment corresponding to the data fragment.

8. The method of claim 7, wherein, The method further comprises: performing at least one redundancy encoding on the encoded data segment to obtain a redundancy check code corresponding to each of the encoded data segments after the at least one redundancy encoding; based on the redundancy check code and a reserved data segment, obtain an encoded data fragment; the reserved data segment is determined based on the checked data fragment and the encoded data segment.

9. The method according to any one of claims 1 to 8, characterized in that, The method further comprises: sending the dynamic image frame in real time to a data receiving end to instruct the data receiving end to decrypt the dynamic image frame based on the received pixel index mapping table to obtain the data fragment.

10. The method of claim 9, wherein, The method further comprises: receiving verification information returned by the data receiving end based on the received dynamic image frame; in the case that the verification information indicates that the data transmission is abnormal, determining a dynamic image frame associated with abnormal data based on the verification information, and recovering the dynamic image frame associated with the abnormal data from a buffer; based on the recovered dynamic image frame, obtain a dynamic image frame for the data fragment again and send it to the data receiving end.

11. A data decryption method characterized by, The method comprises: receiving a dynamic image frame sent in real time by a data sending end, extracting a second pixel layer and a segmentation marker included in the dynamic image frame; the segmentation marker is a segmentation identifier of different image frames; calling a first pixel layer matched with the second pixel layer, the first pixel layer being dynamically generated according to a pre-stored pixel index mapping table, and the pixel index mapping table being used to define a pixel index arrangement rule of the first pixel layer; based on the difference between the second pixel layer and the first pixel layer matched with the second pixel layer and the pixel index mapping table, extracting a data fragment embedded in the second pixel layer.

12. A data encryption device, characterized by comprising: The device comprises: a data segmentation module configured to segment a real-time input data stream into at least one data fragment according to a preset length; The pixel layer generation module is configured to call a first pixel layer used for generating a dynamic image frame, embed the data segment into the first pixel layer, and obtain a second pixel layer; the first pixel layer is dynamically generated according to a pre-stored pixel index mapping table, and the pixel index mapping table is used to define a pixel index arrangement rule of the first pixel layer; The image frame generation module is configured to generate a dynamic image frame in which the data segment is encrypted based on the second pixel layer, and the dynamic image frame includes a segment marker, and the segment marker is a segmentation identifier of different image frames.

13. A data decryption apparatus, characterized by comprising: The device comprises: The pixel layer extraction module is configured to receive a dynamic image frame sent by a data sending end in real time, and extract a second pixel layer and a segment marker included in the dynamic image frame; the segment marker is a segmentation identifier of different image frames. The pixel layer calling module is configured to call a first pixel layer matched with the second pixel layer, and the first pixel layer is dynamically generated according to a pre-stored pixel index mapping table, and the pixel index mapping table is used to define a pixel index arrangement rule of the first pixel layer. The data segment extraction module is configured to extract the data segment embedded in the second pixel layer based on a difference between the second pixel layer and the first pixel layer matched with the second pixel layer and the pixel index mapping table.

14. A data transmission system, characterized by The system comprises: The data sending end is configured to cut a data stream input in real time into a data segment according to a preset length, call a first pixel layer used for generating a dynamic image frame, embed the data segment into the first pixel layer, and obtain a second pixel layer; the first pixel layer is dynamically generated according to a pre-stored pixel index mapping table, and the pixel index mapping table is used to define a pixel index arrangement rule of the first pixel layer; generate a dynamic image frame in which the data segment in the data stream is encrypted based on the second pixel layer, and send the dynamic image frame to a data receiving end in real time; and the dynamic image frame includes a segment marker, and the segment marker is a segmentation identifier of different image frames. The data receiving end is configured to receive a dynamic image frame sent by a data sending end in real time, and extract a second pixel layer and a segment marker included in the dynamic image frame; the segment marker is a segmentation identifier of different image frames; call a first pixel layer matched with the second pixel layer, and the first pixel layer is dynamically generated according to a pre-stored pixel index mapping table, and the pixel index mapping table is used to define a pixel index arrangement rule of the first pixel layer; and extract the data segment embedded in the second pixel layer based on a difference between the second pixel layer and the first pixel layer matched with the second pixel layer and the pixel index mapping table.

15. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that, The processor executes the computer program to implement the steps of the method in any one of claims 1 to 10 and / or implement the steps of the method in claim 11.

16. A computer readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to implement the steps of the method in any one of claims 1 to 10 and / or implement the steps of the method in claim 11.

17. A computer program product comprising a computer program, characterized in that, The computer program, which is executed by a processor, implements the steps of the method according to any one of claims 1 to 10 and / or the steps of the method according to claim 11.

Citation Information

Patent Citations

  • Reversible steganography method and system based on frequency domain image information hiding and electronic equipment

    CN118587077A

  • KR1017970300000B1