Data encryption compression method and device based on chaotic mapping and compression sparse row
Through the data encryption and compression method of chaotic mapping and compressed sparse rows, the problem of limited edge device resources is solved, storage usage is reduced and data security is improved. It is suitable for encryption and compression of deep neural network models on edge devices.
Patent Information
- Application Number
- CN202510778636.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-11
- Publication Date
- 2025-09-19
AI Technical Summary
Due to resource constraints on edge devices, traditional AES encryption technology results in significant performance loss. Furthermore, deep neural network models are large, resulting in excessive storage usage and making them difficult to deploy on edge devices.
A data encryption and compression method based on chaotic mapping and compressed sparse rows is adopted. The data is encrypted by chaotic mapping, unimportant parameters are removed by unstructured pruning, the model storage size is reduced by compressed sparse rows, and the data is obfuscated by XOR operation to generate encrypted compressed values.
It reduces the storage usage of edge devices and improves data security. It is suitable for resource-constrained edge devices and protects the encrypted transmission of deep neural network models.
Smart Images

Figure CN120675755A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of deep neural network data security technology, and in particular to a data encryption and compression method and device based on chaotic mapping and compressed sparse rows. Background Art
[0002] As computing performance and storage capacity of edge devices improve, deep learning systems are gradually expanding from the cloud and being applied to edge devices. By using NPUs (Neural Network Processing Units), edge devices can perform real-time local reasoning based on the current environment without having to establish a connection with a high-latency remote control center.
[0003] Due to diverse deployment environments, edge devices face a new security challenge: vulnerability to physical access-based attacks. Because data transmission between the NPU and the outside world lacks security, if plaintext transmission is used throughout, attackers can easily access the entire neural network model by physically snooping on the memory bus connecting the NPU chip and DRAM (Dynamic Random Access Memory). Therefore, memory encryption is crucial to improving the security of edge devices.
[0004] Common memory encryption technologies, such as direct encryption and counter mode encryption, can be used to protect the confidentiality of deep neural network weights stored off-chip. Direct encryption uses the AES (Advanced Encryption Standard) encryption engine, applies the same global key to all data, and has a high decryption latency; while counter mode encryption uses a counter-based AES encryption engine to generate an OTP (One-time Pad), which can be encrypted and decrypted simply by XORing the OTP with the target data. Since the OTP is never reused, counter mode encryption provides a higher level of security than direct encryption. However, due to the low hardware bandwidth of the NPU, counter encryption still results in a performance loss of more than 50%, which is unacceptable for the NPU.
[0005] Furthermore, as deep neural networks increase in parameters, they typically require more time and memory to process inputs. The high training and inference costs of these models pose a significant challenge to their deployment on devices with limited computing resources, energy, and bandwidth. For example, real-world applications such as autonomous driving, wilderness rescue, and forest fire prevention require both high accuracy and efficient resource utilization, including fast real-time response and a small memory footprint. Excessive computational complexity and memory usage make deployment on edge devices difficult. Summary of the Invention
[0006] The present application provides a data encryption and compression method and device based on chaotic mapping and compressed sparse rows to solve the problem that edge devices often use NPU as a hardware accelerator for deep neural network calculations. Edge devices are usually resource-constrained devices, and traditional AES encryption will bring about large performance loss. At the same time, since deep neural network models are usually large, their storage occupancy needs to be reduced.
[0007] The first aspect of the present application provides a data encryption and compression method based on chaotic mapping and compressed sparse rows, comprising the following steps: encrypting original data using chaotic mapping to generate data ciphertext of the original data; performing unstructured pruning on a preset neural network model to remove parameters that do not meet preset important conditions, generate at least one target model parameter, and based on the at least one target model parameter, compressing sparse rows to determine a model storage size value that meets preset reduction conditions; based on the model storage size value, performing an XOR operation on the byte value of the data ciphertext and a key stream to confuse the data and generate a final encrypted compressed value.
[0008] Optionally, in one embodiment of the present application, before encrypting the original data using chaotic mapping, it also includes: training the preset neural network model by a service provider or a model owner to generate a trained neural network model; and quantizing the weights and biases of the trained neural network model to generate quantized original data.
[0009] Optionally, in one embodiment of the present application, the use of chaotic mapping to encrypt the original data to generate data ciphertext of the original data includes: using a central processing unit to read the incoming weight data to generate a tent mapping; encrypting the weight data according to the value in the tent mapping to generate the data ciphertext.
[0010] Optionally, in one embodiment of the present application, the function of the tent mapping is expressed as:
[0011]
[0012] Among them, a is the mapping parameter, x i is the current state value, x is the state variable, x i+1 is the next state value.
[0013] Optionally, in one embodiment of the present application, compressing the sparse rows to determine the model storage size value that meets the preset reduction conditions includes: storing the values of non-zero elements in the sparse matrix, the column indexes corresponding to the non-zero elements, and the starting positions of the first non-zero elements of each row in the target array to generate storage data; compressing the sparse rows according to the stored data to determine the model storage size value that meets the preset reduction conditions.
[0014] Optionally, in one embodiment of the present application, the XOR operation is performed on the byte value of the ciphertext data and the key stream to confuse the data and generate a final encrypted compressed value, including: XORing the compressed data with the Henon map to generate an XOR result; adding the XOR result to the previous encrypted compressed value to generate an added result; and XORing the added result with the Lorenz chaotic system Lorenz map to generate the final encrypted compressed value.
[0015] Optionally, in one embodiment of the present application, it also includes: in the data decompression and decryption stage, regenerating the Lorenz mapping and the Henon mapping according to preset initial values and control parameters; performing an XOR operation on the encrypted compressed data stream according to the Lorenz mapping and the Henon mapping to generate a decrypted data stream; decompressing the decrypted data stream to generate decompressed data; regenerating the Tent mapping according to the preset initial values and the control parameters, and performing an inverse permutation on the decompressed data according to the Tent mapping to restore the original data.
[0016] The second aspect of the present application provides a data encryption and compression device based on chaotic mapping and compressed sparse rows, including: an encryption module for encrypting original data using chaotic mapping to generate data ciphertext of the original data; a compression module for performing unstructured pruning on a preset neural network model to remove parameters that do not meet preset important conditions, generate at least one target model parameter, and compress sparse rows based on the at least one target model parameter to determine a model storage size value that meets preset reduction conditions; a generation module for performing an XOR operation on the byte value of the data ciphertext and a key stream based on the model storage size value to confuse the data and generate a final encrypted compressed value.
[0017] Optionally, in one embodiment of the present application, it also includes: a training module for training the preset neural network model through a service provider or a model owner before encrypting the original data using a chaotic map to generate a trained neural network model; a quantization module for quantizing the weights and biases of the trained neural network model to generate quantized original data.
[0018] Optionally, in one embodiment of the present application, the encryption module includes: a reading unit for using a central processing unit to read the incoming weight data to generate a tent mapping; an encryption unit for encrypting the weight data according to the value in the tent mapping to generate the data ciphertext.
[0019] Optionally, in one embodiment of the present application, the function of the tent mapping is expressed as:
[0020]
[0021] Among them, a is the mapping parameter, x i is the current state value, x is the state variable, x i+1 is the next state value.
[0022] Optionally, in one embodiment of the present application, the compression module includes: a storage unit for storing the values of non-zero elements in a sparse matrix, the column index corresponding to the non-zero elements, and the starting position of the first non-zero element of each row in the target array to generate storage data; a determination unit for compressing the sparse rows according to the storage data to determine the model storage size value that meets the preset reduction condition.
[0023] Optionally, in one embodiment of the present application, the generation module includes: a result generation unit, used to XOR the compressed data with the Henon map to generate an XOR result; an addition unit, used to add the XOR result with the previous encrypted compressed value to generate an added result; and a compression value generation unit, used to XOR the added result with the Lorenz chaotic system Lorenz map to generate the final encrypted compressed value.
[0024] Optionally, in one embodiment of the present application, it also includes: a regeneration module, used to regenerate the Lorenz map and the Henon map according to preset initial values and control parameters during the data decompression and decryption stage; a data stream generation module, used to perform an XOR operation on the encrypted compressed data stream according to the Lorenz map and the Henon map to generate a decrypted data stream; a decompression module, used to decompress the decrypted data stream to generate decompressed data; and a restoration module, used to regenerate the Tent map according to the preset initial values and the control parameters, so as to perform an inverse permutation on the decompressed data according to the Tent map to restore the original data.
[0025] The third aspect of the present application provides an electronic device, comprising: a memory, a processor, and a computer program stored on the memory and runnable on the processor, wherein the processor executes the program to implement the data encryption and compression method based on chaotic mapping and compressed sparse rows as described in the above embodiment.
[0026] The fourth aspect of the present application provides a computer-readable storage medium, which stores a computer program. When the program is executed by a processor, it implements the above-mentioned data encryption and compression method based on chaotic mapping and compressed sparse rows.
[0027] The embodiment of the present application designs an encryption compression module, and proposes a model encryption scheme based on chaotic mapping and a data compression scheme based on compressed sparse rows. First, compared with the large delay caused by the complex iterative mode of AES, the calculation process of chaotic mapping is simpler and more suitable for resource-constrained devices. Secondly, the data compression scheme based on compressed sparse rows designed in this scheme can effectively reduce the storage occupancy of the model. Not only that, since the actual data size of the compressed neural network model is different from the data size observed by the attacker, the attacker cannot calculate the feature map and the size of the weight based on the observed address data, which plays a certain confusing role. Therefore, the present application can improve data security and reduce storage occupancy. Thus, it solves the problem that edge devices often use NPU as a hardware accelerator for deep neural network calculations, and edge devices are usually resource-constrained devices. Traditional AES encryption will bring about a large performance loss. At the same time, since deep neural network models are usually large, their storage occupancy needs to be reduced.
[0028] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:
[0030] Figure 1 A flowchart of a data encryption and compression method based on chaotic mapping and compressed sparse rows according to an embodiment of the present application;
[0031] Figure 2 This is a diagram of the encryption compression module architecture according to one embodiment of the present application;
[0032] Figure 3 A diagram showing a data compression principle of a neural network model for compressing sparse rows according to an embodiment of the present application;
[0033] Figure 4A schematic structural diagram of a data encryption and compression device based on chaotic mapping and compressed sparse rows according to an embodiment of the present application;
[0034] Figure 5 A schematic diagram of the structure of an electronic device provided according to an embodiment of the present application. DETAILED DESCRIPTION
[0035] The following describes in detail embodiments of the present application, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present application, and should not be construed as limiting the present application.
[0036] The following describes the data encryption and compression method and device based on chaotic mapping and compressed sparse rows of the embodiment of the present application with reference to the accompanying drawings. In view of the fact that the edge devices mentioned in the above background technology often use NPU as a hardware accelerator for deep neural network calculations, and edge devices are usually resource-constrained devices, traditional AES encryption will bring about a large performance loss. At the same time, since the deep neural network model is usually large, it is necessary to reduce its storage occupancy. The present application provides a data encryption and compression method based on chaotic mapping and compressed sparse rows. In this method, data can be encrypted by chaotic mapping to ensure data ciphertext transmission, unimportant parameters in the neural network model can be removed by unstructured pruning, the model storage size can be reduced by compressed sparse rows, and data can be obfuscated by performing XOR operations on byte values and key streams. It is designed for edge devices, protects the ciphertext transmission of deep neural network models, and reduces the storage space occupied by the model. Thus, it solves the problem that edge devices often use NPU as a hardware accelerator for deep neural network calculations, and edge devices are usually resource-constrained devices. Traditional AES encryption will bring about a large performance loss. At the same time, since the deep neural network model is usually large, it is necessary to reduce its storage occupancy.
[0037] Specifically, Figure 1 A flow chart of a data encryption and compression method based on chaotic mapping and compressed sparse rows provided in an embodiment of the present application.
[0038] like Figure 1 As shown, the data encryption and compression method based on chaotic mapping and compressed sparse rows includes the following steps:
[0039] In step S101, the original data is encrypted using a chaotic map to generate a ciphertext of the original data.
[0040] During the actual execution process, the embodiment of the present application can encrypt the original data through the chaotic mapping data encryption module based on the chaotic mapping to generate the data ciphertext of the original data, thereby ensuring the ciphertext transmission of the deep neural network model.
[0041] It should be noted that compared with the large delay caused by the complex iterative mode of AES, the calculation process of chaos mapping is simpler and more suitable for resource-constrained devices.
[0042] Optionally, in one embodiment of the present application, before encrypting the original data using chaotic mapping, it also includes: training a preset neural network model by a service provider or a model owner to generate a trained neural network model; and quantizing the weights and biases of the trained neural network model to generate quantized original data.
[0043] It can be understood that the neural network structure of this application is mainly a convolutional neural network.
[0044] Among them, the embodiment of the present application can perform data preprocessing and quantization. The service provider or model owner trains a preset neural network model to generate a trained neural network model, and quantizes the weights and biases of the trained neural network model to generate quantized raw data. The quantized values are sent to the encryption and compression module for further compression and encryption. The quantization process is completed by the model owner before the data is written to the memory. The quantization process uses an unstructured pruning method to remove individual weights in the neural network according to the size or importance of the weight, that is, to set them to zero.
[0045] Optionally, in one embodiment of the present application, the original data is encrypted using a chaotic map to generate a data ciphertext of the original data, including: using a central processing unit to read the incoming weight data to generate a tent map; encrypting the weight data according to the value in the tent map to generate a data ciphertext.
[0046] During the actual execution process, the embodiment of the present application can perform data reading and cleaning. The CPU reads the incoming weight data and generates a Tent map at the same time, thereby encrypting the read data according to the value in the Tent map.
[0047] In one embodiment of the present application, the function of Tent mapping is expressed as:
[0048]
[0049] Among them, a is the mapping parameter, x i is the current state value, x is the state variable, x i+1 is the next state value.
[0050] The value of a is 0.49, and the initial value x0 is randomly generated, thereby ensuring the randomness of the entire chaotic sequence. The encryption algorithm of the present application has no effect on the statistical characteristics of the data, thereby maintaining the compression rate unchanged.
[0051] Before compressing these incoming "ordered data", encryption shuffling is required. Figure 2 As shown in the encryption module, a 64-byte block is divided into two 32-byte blocks, and each block is assigned a starting pointer (initially 0). The Tent map serves as a Boolean random number generator, generating a Boolean random number by comparing the i-th random number in the map with a threshold T. If the value is 1, the pointers are swapped and incremented; otherwise, only one pointer is incremented. When a pointer reaches the end of a block, the remaining elements are permuted using the Fisher-Yates algorithm.
[0052] In step S102, unstructured pruning is performed on the preset neural network model to remove parameters that do not meet preset important conditions, generate at least one target model parameter, and based on the at least one target model parameter, compress sparse rows to determine a model storage size value that meets preset reduction conditions.
[0053] It can be understood that the at least one target model parameter may be a remaining model parameter after removing unimportant parameters.
[0054] Specifically, the embodiment of the present application can remove unimportant parameters in the neural network model through unstructured pruning based on the data compression module of compressed sparse rows, generate at least one target model parameter, and based on the at least one target model parameter, reduce the model storage size by compressing sparse rows.
[0055] The embodiment of the present application can be designed for edge devices, mainly used to protect the ciphertext transmission of deep neural network models, while reducing the storage space occupied by the model. The data compression scheme based on compressed sparse rows can effectively reduce the storage space occupied by the model. Not only that, since the actual data size of the compressed neural network model is different from the data size observed by the attacker, the attacker cannot calculate the size of the feature map and weight based on the observed address data, which plays a certain obfuscation role, improves data security and reduces storage space occupied.
[0056] Optionally, in one embodiment of the present application, compressing sparse rows to determine a model storage size value that meets a preset reduction condition includes: storing the values of non-zero elements in the sparse matrix, the column indices corresponding to the non-zero elements, and the starting position of the first non-zero element of each row in the target array to generate storage data; compressing the sparse rows according to the stored data to determine the model storage size value that meets the preset reduction condition.
[0057] In the actual execution process, the embodiment of the present application can perform model data compression, and the compression module reads the encrypted weights. It is assumed here that the weights have been pruned before. Studies have shown that a 90% pruning rate has little effect on the model's speculation. Then, a sparse row-based data compression scheme is used to compress the data to reduce the space occupied by the model. The data compression principle of compressed sparse rows is as follows: Figure 3 As shown. Compressed sparse rows use the following three arrays to store sparse matrices:
[0058] 1) data array: stores the values of all non-zero elements in the matrix, arranged in row order.
[0059] 2) column_indices array: stores the column index corresponding to each non-zero element.
[0060] 3) row_pointer array: stores the starting position of the first non-zero element in each row in the data array. Specifically, row_pointer[i] represents the position of the first non-zero element in row i in the data array, and row_pointer[i+1] - row_pointer[i] represents the number of non-zero elements in row i.
[0061] Assume that the number of non-zero elements in the original array is a, the size of the array data and the array column_indices is the number of non-zero elements a, and the size of row_pointer is n+1, so the storage size is 2a+n+1. For example, Figure 3 The data size in is 5×5=25B, of which there are 7 non-zero values and 18 zero values. After sparse row compression, the data array size is 7B, the column_indices array size is 7B, and the row_pointer array size is 6B. The total size of the compressed data is 20B, which can effectively reduce the storage size of the sparse matrix.
[0062] In step S103, based on the model storage size value, an XOR operation is performed on the byte value of the data ciphertext and the key stream to obfuscate the data and generate a final encrypted compressed value.
[0063] During the actual execution process, the embodiment of the present application can reduce the model storage size by compressing sparse rows, and then, based on the model storage size value, perform an XOR operation on the byte value of the data ciphertext and the key stream according to the replacement module of the chaotic map to confuse the data and generate the final encrypted compressed value.
[0064] Optionally, in one embodiment of the present application, an XOR operation is performed on the byte value of the ciphertext data and the key stream to confuse the data and generate a final encrypted compressed value, including: XORing the compressed data with the Henon map to generate an XOR result; adding the XOR result to the previous encrypted compressed value to generate an added result; and XORing the added result with the Lorenz chaotic system Lorenz map to generate the final encrypted compressed value.
[0065] It is understandable that the data reading and shuffling steps in the embodiment of the present application change the byte position and eliminate the correlation between adjacent data, but the plaintext strength distribution remains unchanged, which makes statistical attacks feasible. The replacement module confuses the data by performing an XOR operation on the byte value and the key stream. The replacement stage uses a combination of two chaotic maps: a two-dimensional Henon map and a three-dimensional Lorenz map. Experiments have shown that a single mapping is not sufficient to effectively encrypt weights, so multiple mappings need to be combined. The Tent map is selected for encryption permutation before compression because it is fast, highly random and can retain the key statistical characteristics of the data. The Lorenz and Henon maps have low correlation coefficients, and their combination can construct a highly secure replacement module. Since the replacement occurs after compression, the choice of mapping will not affect the compression rate.
[0066] Specifically, the replacement process in the embodiment of the present application is implemented by an XOR gate and an adder: the compressed data is XORed with the Henon map to generate an XOR result, the XOR result is added to the previous encrypted compressed value to generate an added result, and finally the added result is XORed with the Lorenz chaotic system Lorenz map to generate the final encrypted compressed value.
[0067] Optionally, in one embodiment of the present application, it also includes: in the data decompression and decryption stage, regenerating the Lorenz map and Henon map according to preset initial values and control parameters; performing an XOR operation on the encrypted compressed data stream according to the Lorenz map and the Henon map to generate a decrypted data stream; decompressing the decrypted data stream to generate decompressed data; regenerating the Tent map according to the preset initial values and control parameters, and performing an inverse permutation on the decompressed data according to the Tent map to restore the original data.
[0068] In actual implementation, the decompression and decryption module in the embodiments of the present application performs the inverse of the above process. Using the same initial values and control parameters, the Lorenz and Henon maps are regenerated and XORed with the encrypted compressed data stream. Decompression is then performed to generate decompressed data. Finally, using the same initial conditions and control parameters, the Tent map is regenerated, and the decompressed data is inversely permuted to restore the original data. This will not be described in detail here.
[0069] It should be noted that this application mainly performs data encryption and compression on resource-constrained edge devices to protect the security of neural network model data and reduce the storage size of the data.
[0070] According to the data encryption and compression method based on chaotic mapping and compressed sparse rows proposed in the embodiment of the present application, data can be encrypted by chaotic mapping to ensure data ciphertext transmission, unimportant parameters in the neural network model can be removed by unstructured pruning, the model storage size can be reduced by compressed sparse rows, and data can be obfuscated by performing XOR operations on byte values and key streams. It is designed for edge devices to protect the ciphertext transmission of deep neural network models while reducing the storage space occupied by the model. This solves the problem that edge devices often use NPU as a hardware accelerator for deep neural network calculations, and edge devices are usually resource-constrained devices. Traditional AES encryption will bring about a large performance loss. At the same time, since deep neural network models are usually large, their storage occupancy needs to be reduced.
[0071] Next, a data encryption and compression device based on chaotic mapping and compressed sparse rows proposed in an embodiment of the present application will be described with reference to the accompanying drawings.
[0072] Figure 4 It is a structural diagram of a data encryption and compression device based on chaotic mapping and compressed sparse rows in an embodiment of the present application.
[0073] like Figure 4 As shown, the data encryption and compression device 10 based on chaotic mapping and compressed sparse rows includes: an encryption module 100, a compression module 200 and a generation module 300.
[0074] Specifically, the encryption module 100 is used to encrypt original data using chaotic mapping to generate data ciphertext of the original data.
[0075] The compression module 200 is used to perform unstructured pruning on a preset neural network model to remove parameters that do not meet preset important conditions, generate at least one target model parameter, and compress sparse rows based on the at least one target model parameter to determine a model storage size value that meets preset reduction conditions.
[0076] The generation module 300 is used to perform an XOR operation on the byte value of the data ciphertext and the key stream based on the model storage size value to obfuscate the data and generate a final encrypted compressed value.
[0077] Optionally, in one embodiment of the present application, the data encryption and compression device 10 based on chaotic mapping and compressed sparse rows further includes: a training module and a quantization module.
[0078] Among them, the training module is used to train the preset neural network model through the service provider or model owner before using the chaotic map to encrypt the original data to generate a trained neural network model.
[0079] The quantization module is used to quantize the weights and biases of the trained neural network model to generate quantized raw data.
[0080] Optionally, in one embodiment of the present application, the encryption module 100 includes: a reading unit and an encryption unit.
[0081] The reading unit is used to use the central processing unit to read the input weight data to generate a tent map.
[0082] The encryption unit is used to encrypt the weight data according to the value in the tent mapping to generate data ciphertext.
[0083] Optionally, in one embodiment of the present application, the function of Tent mapping is expressed as:
[0084]
[0085] Among them, a is the mapping parameter, x i is the current state value, x is the state variable, x i+1 is the next state value.
[0086] Optionally, in one embodiment of the present application, the compression module 200 includes: a storage unit and a determination unit.
[0087] The storage unit is used to store the values of non-zero elements in the sparse matrix, the column index corresponding to the non-zero elements, and the starting position of the first non-zero element of each row in the target array to generate storage data.
[0088] A determining unit is configured to compress the sparse rows according to the stored data to determine a model storage size value that satisfies a preset reduction condition.
[0089] Optionally, in one embodiment of the present application, the generation module 300 includes: a result generation unit, an addition unit and a compression value generation unit.
[0090] The result generating unit is used to perform an XOR operation on the compressed data and the Henon map to generate an XOR result.
[0091] The adding unit is used to add the XOR result to the previous encrypted compressed value to generate an added result.
[0092] The compression value generating unit is used to perform an XOR operation on the added result and the Lorenz map of the Lorenz chaotic system to generate a final encrypted compression value.
[0093] Optionally, in one embodiment of the present application, the data encryption and compression device 10 based on chaotic mapping and compressed sparse rows further includes: a regeneration module, a data stream generation module, a decompression module and a restoration module.
[0094] The regeneration module is used to regenerate the Lorenz map and the Henon map according to the preset initial values and control parameters during the data decompression and decryption stages.
[0095] The data stream generation module is used to perform an XOR operation on the encrypted compressed data stream according to the Lorenz map and the Henon map to generate a decrypted data stream.
[0096] The decompression module is used to decompress the decrypted data stream to generate decompressed data.
[0097] The restoration module is used to regenerate the Tent map according to the preset initial values and control parameters, so as to perform inverse permutation on the decompressed data according to the Tent map to restore the original data.
[0098] It should be noted that the above explanation of the embodiment of the data encryption and compression method based on chaotic mapping and compressed sparse rows is also applicable to the data encryption and compression device based on chaotic mapping and compressed sparse rows in this embodiment, and will not be repeated here.
[0099] According to the data encryption and compression device based on chaotic mapping and compressed sparse rows proposed in the embodiment of the present application, data can be encrypted through chaotic mapping to ensure data ciphertext transmission, unimportant parameters in the neural network model can be removed through unstructured pruning, the model storage size can be reduced by compressed sparse rows, and data can be obfuscated by performing XOR operations on byte values and key streams. It is designed for edge devices, protects the ciphertext transmission of deep neural network models, and reduces the storage space occupied by the model. This solves the problem that edge devices often use NPU as a hardware accelerator for deep neural network calculations, and edge devices are usually resource-constrained devices. Traditional AES encryption will bring about a large performance loss. At the same time, since deep neural network models are usually large, their storage occupancy needs to be reduced.
[0100] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. The electronic device may include:
[0101] Memory 501 , processor 502 , and computer programs stored in the memory 501 and executable on the processor 502 .
[0102] When the processor 502 executes the program, the data encryption and compression method based on chaotic mapping and compressed sparse rows provided in the above embodiment is implemented.
[0103] Furthermore, the electronic device further includes:
[0104] The communication interface 503 is used for communication between the memory 501 and the processor 502 .
[0105] The memory 501 is used to store computer programs that can be run on the processor 502 .
[0106] The memory 501 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.
[0107] If the memory 501, processor 502, and communication interface 503 are implemented independently, the communication interface 503, memory 501, and processor 502 can be connected to each other via a bus and communicate with each other. The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 5 Only one thick line is used in the diagram, but this does not mean that there is only one bus or one type of bus.
[0108] Optionally, in a specific implementation, if the memory 501, the processor 502 and the communication interface 503 are integrated on a chip, the memory 501, the processor 502 and the communication interface 503 can communicate with each other through an internal interface.
[0109] The processor 502 may be a central processing unit (CPU), an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present application.
[0110] This embodiment also provides a computer-readable storage medium having a computer program stored thereon. When the program is executed by a processor, the data encryption and compression method based on chaotic mapping and compressed sparse rows is implemented.
[0111] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or N embodiments or examples in a suitable manner. In addition, those skilled in the art can combine and combine different embodiments or examples described in this specification and features of different embodiments or examples without contradiction.
[0112] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be understood to indicate or imply relative importance or implicitly specify the number of technical features indicated. Thus, a feature specified as "first" or "second" may explicitly or implicitly include at least one such feature. In the description of this application, "N" means at least two, for example, two, three, etc., unless otherwise specifically defined.
[0113] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, fragment or portion of code comprising one or N executable instructions for implementing a custom logical function or process step, and the scope of the preferred embodiments of the present application includes alternative implementations in which functions may be performed in a different order than shown or discussed, including performing functions in a substantially simultaneous manner or in a reverse order depending on the functions involved, which should be understood by those skilled in the art to which the embodiments of the present application pertain.
[0114] The logic and / or steps represented in the flowcharts or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing the logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (e.g., a computer-based system, a system including a processor, or other system that can fetch and execute instructions from an instruction execution system, apparatus, or device). For purposes of this specification, a "computer-readable medium" can be any device that can contain, store, communicate, propagate, or transport a program for use by, or in conjunction with, an instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of computer-readable media include the following: an electrical connection with one or N wires (electronic devices), a portable computer disk cartridge (magnetic device), random access memory (RAM), read-only memory (ROM), erasable and programmable read-only memory (EPROM or flash memory), fiber optic devices, and a portable compact disc read-only memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program can be obtained electronically by optically scanning the paper or other medium and then editing, interpreting or processing it in other suitable ways as necessary, and then storing it in a computer memory.
[0115] It should be understood that various parts of the present application can be implemented using hardware, software, firmware, or a combination thereof. In the above embodiment, the N steps or methods can be implemented using software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented using hardware, as in another embodiment, any one of the following technologies known in the art or a combination thereof can be used to implement: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application-specific integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0116] Those skilled in the art will understand that all or part of the steps in the method of the above embodiment can be completed by instructing related hardware through a program, and the program can be stored in a computer-readable storage medium. When the program is executed, it includes one or a combination of the steps of the method embodiment.
[0117] In addition, the functional units in the various embodiments of the present application may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into a module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium.
[0118] The storage medium mentioned above may be a read-only memory, a magnetic disk, or an optical disk, etc. Although the embodiments of the present application have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present application. Persons skilled in the art may make changes, modifications, substitutions, and variations to the above embodiments within the scope of the present application.
Claims
1. A data encryption and compression method based on chaotic mapping and compressed sparse rows, characterized in that: The following steps are involved: Encrypting original data using chaotic mapping to generate data ciphertext of the original data; Performing unstructured pruning on a preset neural network model to remove parameters that do not meet preset important conditions, generating at least one target model parameter, and compressing sparse rows based on the at least one target model parameter to determine a model storage size value that meets a preset reduction condition; Based on the model storage size value, an XOR operation is performed on the byte value of the data ciphertext and the key stream to obfuscate the data and generate a final encrypted compressed value.
2. The method according to claim 1, characterized in that Before encrypting the original data using the chaotic map, it also includes: Training the preset neural network model by a service provider or a model owner to generate a trained neural network model; The weights and biases of the trained neural network model are quantized to generate quantized raw data.
3. The method according to claim 1, characterized in that The method of encrypting the original data by using a chaotic map to generate a ciphertext of the original data includes: The central processing unit reads the incoming weight data to generate a tent map; The weight data is encrypted according to the value in the tent map to generate the data ciphertext.
4. The method according to claim 3, characterized in that The function of the tent mapping is expressed as: Among them, a is the mapping parameter, x i is the current state value, x is the state variable, x i+1 is the next state value.
5. The method according to claim 1, wherein The compressing sparse rows to determine a model storage size value that satisfies a preset reduction condition includes: Store the values of non-zero elements in the sparse matrix, the column indices corresponding to the non-zero elements, and the starting position of the first non-zero element of each row in the target array to generate storage data; The sparse rows are compressed according to the stored data to determine the model storage size value that meets the preset reduction condition.
6. The method according to claim 1, characterized in that The performing an XOR operation on the byte value of the ciphertext data and the key stream to obfuscate the data and generate a final encrypted compressed value includes: XOR the compressed data with the Henon map to generate an XOR result; Adding the XOR result to the previous encrypted compressed value to generate an added result; The added result is XORed with the Lorenz map of the Lorenz chaotic system to generate the final encrypted compressed value.
7. The method according to claim 6, characterized in that Also includes: During the data decompression and decryption phase, the Lorenz map and the Henon map are regenerated according to preset initial values and control parameters; Performing an XOR operation on the encrypted compressed data stream according to the Lorenz map and the Henon map to generate a decrypted data stream; Decompressing the decrypted data stream to generate decompressed data; The tent map is regenerated according to the preset initial value and the control parameter, so as to perform inverse substitution on the decompressed data according to the tent map to restore the original data.
8. A data encryption and compression device based on chaotic mapping and compressed sparse rows, characterized in that: include: An encryption module, used for encrypting original data using a chaotic map to generate a ciphertext of the original data; a compression module, configured to perform unstructured pruning on a preset neural network model to remove parameters that do not meet preset important conditions, generate at least one target model parameter, and compress sparse rows based on the at least one target model parameter to determine a model storage size value that meets a preset reduction condition; A generation module is used to store the size value based on the model, perform an XOR operation on the byte value of the data ciphertext and the key stream to obfuscate the data and generate a final encrypted compressed value.
9. An electronic device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the data encryption and compression method based on chaotic mapping and compressed sparse rows as described in any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: The program is executed by a processor to implement the data encryption and compression method based on chaotic mapping and compressed sparse rows as described in any one of claims 1 to 7.