A method and system for encrypting and storing data for gas detectors
By synchronizing and generating random functions for gas detector data packets, hybrid storage and rapid location of gas detector data are achieved, solving the problem of low read/write efficiency caused by separate data storage and independent encryption, and improving data storage and location efficiency.
Patent Information
- Application Number
- CN202510651572.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-20
- Publication Date
- 2025-10-31
- Estimated Expiration
- 2045-05-20
AI Technical Summary
The detection data generated by the gas detector during the detection process is stored separately and encrypted independently, which means that the entire data needs to be decrypted when it is read, affecting the data read and write efficiency.
By synchronizing data packets from multiple gas detectors within the same time period, using a randomly generated function to change the data storage order, mixing and storing the data, and achieving rapid positioning through the joint storage of header and tail data, storage and positioning efficiency are improved.
This greatly improves the efficiency of gas detector data storage and positioning, and reduces the requirements for computing power.
Smart Images

Figure CN120162012B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of data storage technology, and in particular relates to a data encryption and storage method and system for gas detectors. Background Technology
[0002] A gas detector is a device used to detect the concentration of one or more gases in an environment. It converts gas concentration into an electrical signal through a sensor, thereby enabling precise monitoring of the leakage or presence of a specific gas. This device is widely used in industrial safety, environmental protection, and home security, providing timely warnings of the presence of toxic and harmful gases to protect human life and environmental health. Gas detectors can detect a variety of gases, including but not limited to carbon monoxide, carbon dioxide, methane, and oxygen, and are of great significance for accident prevention and ensuring production safety.
[0003] During the detection process, gas detectors continuously generate a large amount of detection data. This data is usually stored separately and encrypted independently. When reading the data, the entire data needs to be decrypted, which affects the data read and write efficiency. Summary of the Invention
[0004] The purpose of this invention is to provide a data encryption and storage method for gas detectors, which aims to solve the problem that detection data is generally stored separately and encrypted independently, and that the entire data needs to be decrypted when read, which affects the data read and write efficiency.
[0005] This invention is implemented as follows: a data encryption and storage method for a gas detector, the method comprising:
[0006] The detection data of each gas detector is acquired at preset time intervals to obtain multiple gas detector data packets;
[0007] The data volume of each gas detector data packet is obtained, normalized, and the first function is constructed based on the normalization result.
[0008] The gas detector data packets are integrated and processed. The storage order of the data in the gas detector data packets is output through the first function to obtain the tail data.
[0009] Obtain the identity data from the tail data, perform data transformation on the first function, combine the identity data to form the header data, and then store the header data and tail data together.
[0010] Preferably, the step of acquiring the data volume of each gas detector data packet, performing normalization processing, and constructing a first function based on the normalization processing result specifically includes:
[0011] Read the data packets of each gas detector one by one and identify the amount of data they contain;
[0012] The detection parameters of each gas detector are obtained, the detection range is determined based on the historical data of the gas detector, and the data volume is normalized according to the detection range to obtain the normalized result.
[0013] Based on the normalization results, the normalized data sequence corresponding to each gas detector data packet is determined. Then, a function is fitted based on the normalized data sequence to obtain the first function.
[0014] Preferably, the step of integrating the gas detector data packets and outputting the storage order of the data within the gas detector data packets through a first function to obtain the tail data specifically includes:
[0015] The gas detection data packets are spliced together in a preset order. During splicing, all gas detector data packets are divided into data blocks of a preset size. Each data block is the smallest data unit to be stored in this instance.
[0016] Determine the number of each smallest data unit, use the number of the smallest data unit as the independent variable, import it into the first function, and output the numerical string;
[0017] Each time, a preset number of storage units are retrieved from the physical storage space. The storage unit corresponding to the current smallest data unit is determined based on the numerical string and stored to obtain the tail data.
[0018] Preferably, the steps of obtaining the identity data from the tail data, performing data transformation on the first function, combining the identity data to form the header data, and jointly storing the header data and tail data specifically include:
[0019] Obtain the identity data of the tail data and the corresponding first function, convert the first function into a binary string of a preset length, and then convert it into a decimal string;
[0020] A second function is constructed by combining multiple sets of decimal strings, and the decimal string corresponding to the first function is used as the independent variable to generate the hidden data corresponding to the first function;
[0021] The hidden data is combined with the identity data to obtain the header data. The header data and the tail data are then integrated and stored. The identity data is used to determine the identity of the corresponding tail data.
[0022] Preferably, the identification data includes at least the collection time interval corresponding to the gas detector data packet.
[0023] Another object of the present invention is to provide a data encryption and storage system for a gas detector, the system comprising:
[0024] The data acquisition module is used to acquire the detection data of each gas detector at preset time intervals to obtain multiple gas detector data packets;
[0025] The function construction module is used to obtain the data volume of each gas detector data packet, perform normalization processing, and construct the first function based on the normalization processing result;
[0026] The tail data generation module is used to integrate and process the gas detector data packets. It outputs the storage order of the data in the gas detector data packets through the first function to obtain the tail data.
[0027] The header data generation module is used to obtain the identity data of the tail data, perform data transformation on the first function, combine the identity data to form header data, and jointly store the header data and tail data.
[0028] Preferably, the function construction module includes:
[0029] The data extraction unit is used to read the data packets of each gas detector one by one and identify the amount of data contained therein.
[0030] The normalization processing unit is used to acquire the detection parameters of each gas detector, determine the detection range based on the historical data of the gas detector, and normalize each data volume according to the detection range to obtain the normalization processing result.
[0031] The function fitting unit is used to determine the normalized data sequence corresponding to each gas detector data packet based on the normalization processing result, and to perform function fitting based on the normalized data sequence to obtain the first function.
[0032] Preferably, the tail data generation module includes:
[0033] The data splicing unit is used to splice gas detection data packets in a preset order. During splicing, all gas detector data packets are divided into data blocks of a preset size. Each data block is the smallest data unit to be stored in this instance.
[0034] The data calculation unit is used to determine the number of each smallest data unit. The number of the smallest data unit is used as the independent variable and imported into the first function to output a numerical string.
[0035] The tail data storage unit is used to retrieve a preset number of storage units from the physical storage space each time, determine the storage unit corresponding to the current smallest data unit based on the numerical string, and store it to obtain the tail data.
[0036] Preferably, the header data generation module includes:
[0037] The data conversion unit is used to obtain the identification data of the tail data and the corresponding first function, convert the first function into a binary string of a preset length, and then convert it into a decimal string;
[0038] The function hiding unit is used to combine multiple sets of decimal strings to construct a second function, using the decimal string corresponding to the first function as the independent variable to generate the hidden data corresponding to the first function;
[0039] The data integration unit is used to combine hidden data with identity identification data to obtain header data. After the header data and tail data are integrated, they are stored. The identity identification data is used to determine the identity of the corresponding tail data.
[0040] Preferably, the identification data includes at least the collection time interval corresponding to the gas detector data packet.
[0041] This invention provides a data encryption and storage method for gas detectors. By synchronizing data packets from multiple gas detectors within the same time period and changing the data storage order through a randomly generated function, the data from multiple gas detectors is mixed and stored together to achieve encryption. Furthermore, by setting header and tail data, the required data can be quickly located, greatly improving data storage and location efficiency, and requiring low computing power. Attached Figure Description
[0042] Figure 1 A flowchart of a data encryption and storage method for a gas detector provided in an embodiment of the present invention;
[0043] Figure 2 The flowchart below shows the steps of obtaining the data volume of each gas detector data packet, performing normalization processing, and constructing a first function based on the normalization processing result, as provided in the embodiments of the present invention.
[0044] Figure 3 The flowchart illustrates the steps of integrating gas detector data packets and obtaining tail data by outputting the storage order of data within the gas detector data packets through a first function, as provided in this embodiment of the invention.
[0045] Figure 4 The flowchart illustrates the steps of obtaining the identity data of the tail data, performing data transformation on the first function, combining the identity data to form the header data, and jointly storing the header data and the tail data, as provided in this embodiment of the invention.
[0046] Figure 5An architecture diagram of a data encryption and storage system for a gas detector provided in an embodiment of the present invention;
[0047] Figure 6 An architecture diagram of a function construction module provided in an embodiment of the present invention;
[0048] Figure 7 An architecture diagram of a tail data generation module provided in an embodiment of the present invention;
[0049] Figure 8 This is an architecture diagram of a header data generation module provided in an embodiment of the present invention. Detailed Implementation
[0050] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.
[0051] like Figure 1 The diagram shows a flowchart of a data encryption and storage method for a gas detector provided by an embodiment of the present invention. The method includes:
[0052] S100 acquires detection data from each gas detector at preset time intervals to obtain multiple gas detector data packets.
[0053] In this step, detection data from each gas detector is acquired at preset time intervals. There can be multiple gas detectors. By setting multiple or different types of gas detectors, multiple gases can be detected simultaneously, and multiple locations can be detected. Each gas detector generates a corresponding gas detector data packet, which is temporarily stored within the gas detector. Data is collected by the acquisition device at preset time intervals. The acquisition device packages the data from one gas detector together to obtain multiple gas detector data packets.
[0054] S200: Obtain the data volume of each gas detector data packet, perform normalization processing, and construct the first function based on the normalization processing result.
[0055] In this step, the data volume of each gas detector data packet is obtained. Due to the different detection frequencies and data types of each gas detector, the data volume contained in each gas detector data packet varies within the same time period. To facilitate processing, the data volume of the gas detector data packets is normalized and organized into values within a specified range, such as values within the range AB. The number of the gas detector data packet is determined, and a data volume coordinate is constructed based on the number and the corresponding data volume in the normalization result. Using the data volume coordinate as the data source, a data coordinate fitting method is used to form the first function corresponding to the above data volume coordinate. Since the data collected by the gas detectors within the same time period are different, the data volume will also vary. Therefore, the data volume coordinate is randomly changing, and the resulting first function is also randomly changing.
[0056] S300 integrates and processes the gas detector data packets, outputs the storage order of the data within the gas detector data packets through the first function, and obtains the tail data.
[0057] In this step, the gas detector data packets are integrated and spliced together to form a whole. Then, the gas detector data packets are split into multiple data blocks, each of which is a minimum data unit. After obtaining the first function, the data blocks are numbered to determine the number of each data block. The data block number is used as input and imported into the first function. Each data block will correspond to a data result. The data result is processed according to preset rules to determine the position of each data block in the storage space, thereby completing the storage of all gas detector data packets in this batch and obtaining the tail data.
[0058] S400: Obtain the identity data of the tail data, perform data transformation on the first function, combine the identity data to form the header data, and jointly store the header data and tail data.
[0059] In this step, the identification data of the tail data is obtained. An identification data set is assigned to each tail data point to determine its identity. The identification data must at least contain the acquisition time interval corresponding to the gas detector data packet, and may also include additional identification data such as the gas detector model and location. To ensure data security, the first function is transformed. A second function is constructed, using the identification data as its independent variable. Its output is the transformed first function. The transformed first function is combined with the identification data to obtain the header data. The header data is then integrated with the tail data and stored, thus completing the process. The storage of a batch of gas detector data packets involves establishing an independent database to store the second function and its corresponding identification data. When the identification data or the second function is updated, the corresponding independent database is updated synchronously. When data from the tail data is needed, the identification data is used as the retrieval source to locate the header data. The tail data is then determined based on the header data. The corresponding second function is retrieved from the independent database, and the first function is recovered using the second function. The storage order of the data blocks is determined based on the first function and the numbers of all data blocks, in order to recover the overall data formed by splicing multiple gas detector data packets, thus obtaining multiple gas detector data packets.
[0060] like Figure 2 As shown, in a preferred embodiment of the present invention, the step of acquiring the data volume of each gas detector data packet, performing normalization processing, and constructing a first function based on the normalization processing result specifically includes:
[0061] S201 reads the data packets of each gas detector one by one and identifies the amount of data contained therein.
[0062] In this embodiment, each gas detector data packet is read one by one. The data packets of the same batch of gas detectors come from the same time period. Since the models of gas detectors and gas concentrations are different, they will contain different amounts of data. The amount of data is then counted.
[0063] S202: Obtain the detection parameters of each gas detector, determine the detection range based on the historical data of the gas detector, and normalize each data volume according to the detection range to obtain the normalization result.
[0064] In this embodiment, the detection parameters of each gas detector are obtained. The detection range of each gas detector is different. For example, the maximum detection concentration of gas detector a is M1 and the minimum detection concentration is M2. Then the data obtained by it are all within the above range. However, since the concentration of the detected gas may only fluctuate within a small range, such as between M3 and M4, where M1 < M3 < M4 < M2, the historical data of the gas detector is retrieved. Based on the historical data of the gas detector, the current gas concentration fluctuation range is determined. The maximum and minimum data volume in the historical data are extracted. The maximum and minimum data volume are used as the upper and lower limits for normalization processing. The data volume of each gas detector data packet is unified to the range of n1 to n2. For example, the maximum data volume is n1 and the minimum data volume is n2. After normalization, the data volume n is (n-n2) / (n1-n2).
[0065] S203. Based on the normalization processing results, determine the normalized data quantity sequence corresponding to each gas detector data packet, and perform function fitting based on the normalized data quantity sequence to obtain the first function.
[0066] In this embodiment, the normalized data quantity sequence corresponding to each gas detector data packet is determined based on the normalization processing result. The number of each gas detector data packet and the normalized data quantity corresponding to that gas detector data packet are determined. A normalized data quantity sequence is constructed, the number and the corresponding normalized data quantity are extracted, data quantity coordinates are constructed, and the data quantity coordinates are fitted to obtain the first function.
[0067] like Figure 3 As shown, in a preferred embodiment of the present invention, the step of integrating the gas detector data packet and outputting the storage order of the data within the gas detector data packet through a first function to obtain the tail data specifically includes:
[0068] S301. The gas detection data packets are spliced together in a preset order. During splicing, all gas detector data packets are divided into data blocks of a preset size. Each data block is the smallest data unit to be stored in this operation.
[0069] In this embodiment, the gas detection data packets are spliced together in a preset order and then disassembled. Each gas detection data packet is divided into data blocks of the same size, and an independent number is written into each data block to determine the gas detector data packet to which each data block belongs.
[0070] S302: Determine the number of each smallest data unit, use the number of the smallest data unit as the independent variable, import it into the first function, and output the numerical string.
[0071] In this embodiment, the number of each smallest data unit is determined. Specifically, the number of the data block is extracted and regarded as the independent variable. The first function outputs the corresponding calculation result according to the independent variable, and the calculation result is regarded as a string, that is, the numerical string is obtained.
[0072] S303: Each time, a preset number of storage units are retrieved from the physical storage space, the storage unit corresponding to the current smallest data unit is determined according to the numerical string, and the data is stored to obtain the tail data.
[0073] In this embodiment, a preset number of storage units are retrieved from the physical storage space each time. These storage units are used to store the smallest data units. A corresponding size of physical storage space is retrieved based on the total number of the smallest data units. This physical storage space is also divided into the same number of storage units and numbered consecutively. A preset number of characters are extracted from the beginning of the numerical string (e.g., two characters). During this process, a preset number of storage units without stored data are selected from the physical storage space according to the storage unit numbering order. If the number of extracted characters is d, then the largest number corresponding to d decimal characters is D. The retrieved data... The number of storage units is D+1. When retrieving a storage unit, the first storage unit is numbered 0. Starting from zero, the number increases by 1 each time. If the storage unit with the current number is not stored, it is retrieved until the number of retrieved storage units reaches a preset value. The storage location of the database is determined based on the extracted character. For example, if the extracted character is 78, the 78th storage unit is selected from the D+1 storage units retrieved this time, and the data block is stored in that storage unit. Based on this, the storage location of all data blocks is determined. After all data blocks are stored, the data blocks are connected as a whole to obtain the tail data.
[0074] like Figure 4 As shown, in a preferred embodiment of the present invention, the steps of obtaining the identity data of the tail data, performing data transformation on the first function, combining the identity data to form the header data, and jointly storing the header data and the tail data specifically include:
[0075] S401, obtain the identity data of the tail data and the corresponding first function, convert the first function into a binary string of a preset length, and then convert it into a decimal string.
[0076] In this step, the identification data of the tail data and the corresponding first function are obtained. The identification data is used to determine the data content contained in this part of the tail data. It can be represented by a time value, indicating the time range to which the data contained in the current tail data belongs. It can also contain data such as gas type and detector type to facilitate subsequent retrieval. The first function is converted into a binary string of a preset length. If the length of the binary string after conversion does not reach the preset length, 0 is added to the front of the binary string until the whole reaches the preset length. Then it is converted into a decimal string.
[0077] S402, combine multiple sets of decimal strings to construct a second function, use the decimal string corresponding to the first function as the independent variable, and generate the hidden data corresponding to the first function.
[0078] In this step, a second function is constructed by combining multiple sets of decimal strings. When storing data, multiple batches of gas detection data packets can be processed together. For example, if the acquisition device performs 10 data acquisitions within one hour, resulting in ten batches of gas detector data packets, and the acquisition time is the same for the same batch, then each batch of gas detector data packets will correspond to a first function, which in turn corresponds to a decimal string. String coordinates are constructed according to batch order, with the horizontal axis representing the batch number and the vertical axis representing the decimal string. The corresponding second function is obtained through fitting. These ten batches of gas detection data packets share the current second function. The fitting tool can be a data analysis tool such as MATLAB. If the number of batches is small, a decimal string can be randomly generated to obtain the second function. The decimal string corresponding to the first function is imported into the second function to obtain the calculated value, which is the hidden data corresponding to the first function.
[0079] S403, combine the hidden data with the identity data to obtain the header data. After integrating the header data and the tail data, store them. The identity data is used to determine the identity of the corresponding tail data.
[0080] In this step, the hidden data and the identification data are combined to obtain the header data. The hidden data is essentially the first function. With the first function, the gas detection data packet contained in the tail data can be decrypted. The header data contains the identification data, which facilitates retrieval. Therefore, when a certain data needs to be retrieved, it can be retrieved first through the header data. After that, the corresponding second function is retrieved, and the inverse function of the second function is calculated. Based on the hidden data in the header data and the inverse function of the second function, the decimal string corresponding to the first function is calculated and restored to binary data, thus obtaining the first function. After obtaining the first function, the arrangement order of the data blocks can be determined according to the number of data blocks contained in the tail data, thereby recovering the gas detector data packet. If the gas detector data packet is modified, it will affect the first and second functions in the next storage process, realizing the updating of the first and second functions.
[0081] like Figure 5 As shown, an embodiment of the present invention provides a data encryption and storage system for a gas detector, the system comprising:
[0082] The data acquisition module 100 is used to acquire the detection data of each gas detector at preset time intervals to obtain multiple gas detector data packets.
[0083] In this step, the data acquisition module 100 acquires the detection data of each gas detector at preset time intervals. There can be multiple gas detectors. By setting multiple and different types of gas detectors, multiple gases can be detected simultaneously, and multiple locations can be detected. Each gas detector will generate a corresponding gas detector data packet. The gas detector data packets are temporarily stored in the gas detector. The acquisition device acquires data at preset time intervals and packages the data from one gas detector together to obtain multiple gas detector data packets.
[0084] The function construction module 200 is used to obtain the data volume of each gas detector data packet, perform normalization processing, and construct the first function based on the normalization processing result.
[0085] In this step, the function construction module 200 obtains the data volume of each gas detector data packet. Due to the different detection frequencies and data types of each gas detector, the data volume contained in each gas detector data packet varies within the same time period. To facilitate processing, the data volume of the gas detector data packets is normalized and organized into values within a specified range, such as values within the range AB. The number of the gas detector data packet is determined, and a data volume coordinate is constructed based on the number and the data volume in the corresponding normalization result. Using the data volume coordinate as the data source, a data coordinate fitting method is adopted to form the first function corresponding to the above data volume coordinate. Since the data collected by the gas detectors within the same time period are different, the data volume will also vary. Therefore, the data volume coordinate changes randomly, and the resulting first function also changes randomly.
[0086] The tail data generation module 300 is used to integrate and process the gas detector data packets. It outputs the storage order of the data in the gas detector data packets through the first function to obtain the tail data.
[0087] In this step, the tail data generation module 300 integrates the gas detector data packets, splices them together to form a whole, and then splits the gas detector data packets into multiple data blocks, each of which is a minimum data unit. After obtaining the first function, the data blocks are numbered to determine the number of each data block. The data block number is used as input and imported into the first function. Each data block will correspond to a data result. The data result is processed according to preset rules to determine the position of each data block in the storage space, thereby completing the storage of all gas detector data packets in this batch and obtaining the tail data.
[0088] The header data generation module 400 is used to obtain the identity data of the tail data, perform data transformation on the first function, combine the identity data to form header data, and jointly store the header data and tail data.
[0089] In this step, the header data generation module 400 acquires the identification data of the tail data, assigning an identification data set to each tail data item. This identification data is used to determine the identity of the tail data item. The identification data at least includes the acquisition time interval corresponding to the gas detector data packet, and may also include additional identification data such as the gas detector's model and location. To ensure data security, the first function undergoes data transformation. A second function is constructed, using the identification data as its independent variable; its output is the transformed first function. The transformed first function is combined with the identification data to obtain the header data. The header data and tail data are then integrated and stored. This involves storing the gas detector data packets for this batch, establishing an independent database to store the second function and its corresponding identification data, and synchronously updating the independent database when the identification data or the second function is updated. When data from the tail data is needed, the identification data is used as the retrieval source to locate the header data, the tail data is determined based on the header data, the corresponding second function is retrieved from the independent database, the first function is recovered through the second function, and the storage order of the data blocks is determined based on the first function and the numbers of all data blocks, so as to recover the overall data formed by splicing multiple gas detector data packets, thus obtaining multiple gas detector data packets.
[0090] like Figure 6 As shown, in a preferred embodiment of the present invention, the function construction module 200 includes:
[0091] The data extraction unit 201 is used to read each gas detector data packet one by one and identify the amount of data contained therein.
[0092] In this module, the data extraction unit 201 reads each gas detector data packet one by one. The data packets of the same batch of gas detectors contain data from the same time period. Due to the different models of gas detectors and gas concentrations, they will contain different amounts of data. The data volume is then statistically analyzed.
[0093] The normalization processing unit 202 is used to acquire the detection parameters of each gas detector, determine the detection range based on the historical data of the gas detector, and normalize each data volume according to the detection range to obtain the normalization processing result.
[0094] In this module, the normalization processing unit 202 acquires the detection parameters of each gas detector. Each gas detector has a different detection range. For example, the maximum detection concentration of gas detector a is M1 and the minimum detection concentration is M2. The data obtained by it are all within the above range. However, since the concentration of the detected gas may only fluctuate within a small range, such as between M3 and M4, where M1 < M3 < M4 < M2, the historical data of the gas detector is retrieved. Based on the historical data of the gas detector, the current concentration fluctuation range of the gas is determined. The maximum and minimum data volume in the historical data are extracted. Using the maximum and minimum data volume as the upper and lower limits, normalization processing is performed to unify the data volume of each gas detector data packet to the range of n1 to n2. For example, if the maximum data volume is n1 and the minimum data volume is n2, the normalized data volume n is (n-n2) / (n1-n2).
[0095] The function fitting unit 203 is used to determine the normalized data quantity sequence corresponding to each gas detector data packet based on the normalization processing result, and to perform function fitting based on the normalized data quantity sequence to obtain the first function.
[0096] In this module, the function fitting unit 203 determines the normalized data quantity sequence corresponding to each gas detector data packet based on the normalization processing result, determines the number of each gas detector data packet and the normalized data quantity corresponding to that gas detector data packet, constructs a normalized data quantity sequence, extracts the number and the corresponding normalized data quantity, constructs data quantity coordinates, and fits the data quantity coordinates to obtain the first function.
[0097] like Figure 7 As shown, in a preferred embodiment of the present invention, the tail data generation module 300 includes:
[0098] The data splicing unit 301 is used to splice gas detection data packets in a preset order. During splicing, all gas detector data packets are divided into data blocks of a preset size. Each data block is the smallest data unit to be stored in this instance.
[0099] In this module, the data splicing unit 301 splices the gas detection data packets in a preset order, disassembles the gas detection data packets, divides each gas detection data packet into data blocks of the same size, and writes an independent number into each data block to determine the gas detector data packet to which each data block belongs.
[0100] Data calculation unit 302 is used to determine the number of each smallest data unit, and uses the number of the smallest data unit as the independent variable to import it into the first function to output a numerical string.
[0101] In this module, the data calculation unit 302 determines the number of each smallest data unit. Specifically, it extracts the number of the data block and treats it as an independent variable. The first function outputs the corresponding calculation result based on the independent variable and treats the calculation result as a string, thus obtaining a numerical string.
[0102] The tail data storage unit 303 is used to retrieve a preset number of storage units from the physical storage space each time, determine the storage unit corresponding to the current smallest data unit according to the numerical string, and store it to obtain the tail data.
[0103] In this module, the tail data storage unit 303 retrieves a preset number of storage units from the physical storage space each time. These storage units are used to store the smallest data units. Based on the total number of smallest data units, a corresponding size of physical storage space is retrieved. This physical storage space is then divided into the same number of storage units and numbered consecutively. A preset number of characters are extracted from the beginning of the numerical string (e.g., two characters). During this process, a preset number of storage units without stored data are selected from the physical storage space according to the storage unit numbering order. If the number of extracted characters is d, then the largest number corresponding to d decimal characters is D. The number of storage units retrieved is D+1. When retrieving storage units, the first storage unit is numbered 0. Starting from zero, the number increases by 1 each time. If the storage unit with the current number is not stored, it is retrieved until the number of retrieved storage units reaches the preset value. The storage location of the database is determined based on the extracted character. For example, if the extracted character is 78, the 78th storage unit is selected from the D+1 storage units retrieved this time, and the data block is stored in the storage unit. Based on this, the storage location of all data blocks is determined. After all data blocks are stored, the data blocks are connected as a whole to obtain the tail data.
[0104] like Figure 8 As shown, in a preferred embodiment of the present invention, the header data generation module 400 includes:
[0105] The data conversion unit 401 is used to obtain the identification data of the tail data and the corresponding first function, convert the first function into a binary string of a preset length, and then convert it into a decimal string.
[0106] In this module, the data conversion unit 401 acquires the identification data of the tail data and the corresponding first function. The identification data is used to determine the data content contained in this part of the tail data. It can be characterized by time values to indicate the time range to which the data contained in the current tail data belongs. It can also contain data such as gas type and detector type to facilitate subsequent retrieval. The first function is converted into a binary string of a preset length. If the length of the binary string after conversion does not reach the preset length, 0 is added to the front of the binary string until the whole reaches the preset length. Then it is converted into a decimal string.
[0107] Function hiding unit 402 is used to construct a second function by combining multiple sets of decimal strings, and to generate hidden data corresponding to the first function by using the decimal string corresponding to the first function as the independent variable.
[0108] In this module, the function hiding unit 402 constructs a second function by combining multiple sets of decimal strings. During data storage, multiple batches of gas detection data packets can be processed together. For example, if the acquisition device performs 10 data acquisitions within one hour, resulting in ten batches of gas detector data packets, and the acquisition time is the same for the same batch, then each batch of gas detector data packets will correspond to a first function, which in turn corresponds to a decimal string. String coordinates are constructed according to batch order, with the horizontal axis representing the batch number and the vertical axis representing the decimal string. The corresponding second function is obtained through fitting. These ten batches of gas detection data packets share the current second function. The fitting tool can be a data analysis tool such as MATLAB. If the number of batches is small, a decimal string can be randomly generated to obtain the second function. The decimal string corresponding to the first function is imported into the second function to obtain the calculated value, which is the hidden data corresponding to the first function.
[0109] The data integration unit 403 is used to combine the hidden data with the identity identification data to obtain the header data. After the header data and the tail data are integrated, they are stored. The identity identification data is used to determine the identity of the corresponding tail data.
[0110] In this module, the data integration unit 403 combines the hidden data with the identification data to obtain the header data. The hidden data is essentially the first function. With the first function, the gas detection data packet contained in the tail data can be decrypted. The header data contains the identification data, which facilitates retrieval. Therefore, when a certain data needs to be retrieved, it can first be retrieved through the header data. After that, the corresponding second function is retrieved, and the inverse function of the second function is calculated. Based on the hidden data in the header data and the inverse function of the second function, the decimal string corresponding to the first function is calculated and restored to binary data, thus obtaining the first function. After obtaining the first function, the arrangement order of the data blocks can be determined according to the number of data blocks contained in the tail data, thereby restoring the gas detector data packet. If the gas detector data packet is modified, it will affect the first and second functions in the next storage process, realizing the updating of the first and second functions.
[0111] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A method for encrypting and storing data in a gas detector, characterized in that, The method includes: The system acquires detection data from all gas detectors within the same acquisition time interval. Each gas detector generates an independent gas detector data packet, resulting in multiple gas detector data packets. Each acquisition time interval corresponds to one acquisition batch. The data volume of multiple gas detector data packets in a single acquisition batch is obtained, normalized, and a first function is constructed based on the normalization result, specifically including: Read the data packets of each gas detector one by one and identify the amount of data they contain; The detection parameters of each gas detector are acquired, the detection range is determined based on the historical data of the gas detectors, and each data point is normalized according to the detection range. Based on the number of each gas detector data packet and the corresponding normalized data volume, a normalized data volume sequence is constructed. The number and the corresponding normalized data volume are extracted, data volume coordinates are constructed, and the data volume coordinates are fitted to obtain the first function. The process of integrating the multiple gas detector data packets and obtaining tail data through a first function includes: splicing the multiple gas detector data packets in a preset order to form a whole; dividing the whole into multiple data blocks, where each data block is the smallest unit for storing data; determining the number of each data block; using the data block number as input to the first function; processing the data results according to preset rules; determining the location of each data block in the storage space; and completing the storage of all gas detector data packets in this batch. The integrated data formed after storage is the tail data. Obtain the identity data from the tail data, perform data transformation on the first function, combine the identity data to form the header data, and then jointly store the header data and tail data, specifically including: The identification data and corresponding first function of the tail data are obtained, encoded into a binary string of a preset length, and then converted into a decimal string. Each batch of detection data corresponds to a first function. Multiple first functions corresponding to the detection data obtained from multiple batches are converted into decimal strings. Based on the multiple collection batch serial numbers and their corresponding decimal strings, a second function is constructed. The decimal string corresponding to the first function is used as the input variable to the second function to generate the hidden data corresponding to the first function. The hidden data is combined with the identity data to obtain the header data. The header data is then integrated with the tail data and stored.
2. The data encryption and storage method for a gas detector according to claim 1, characterized in that, The identification data includes at least the collection time interval corresponding to the gas detector data packet.
3. A data encryption and storage system for a gas detector, characterized in that, The system includes: The data acquisition module is used to acquire detection data from all gas detectors within the same acquisition time interval. Each gas detector generates an independent gas detector data packet, resulting in multiple gas detector data packets. Each acquisition time interval corresponds to one acquisition batch. The function construction module is used to obtain the data volume of multiple gas detector data packets in a batch, perform normalization processing, and construct the first function based on the normalization result, specifically including: Read the data packets of each gas detector one by one and identify the amount of data they contain; The detection parameters of each gas detector are acquired, the detection range is determined based on the historical data of the gas detectors, and each data point is normalized according to the detection range. Based on the number of each gas detector data packet and the corresponding normalized data volume, a normalized data volume sequence is constructed. The number and the corresponding normalized data volume are extracted, data volume coordinates are constructed, and the data volume coordinates are fitted to obtain the first function. The tail data generation module is used to integrate and process the multiple gas detector data packets. The tail data is obtained through a first function. Specifically, it includes: splicing the multiple gas detector data packets in a preset order to form a whole; dividing the whole into multiple data blocks, where each data block is the smallest unit for storing data; determining the number of each data block; using the data block number as input to the first function; processing the data results according to preset rules; determining the location of each data block in the storage space; and completing the storage of all gas detector data packets in this batch. The integrated data formed after storage is the tail data. The header data generation module is used to obtain the identity data of the tail data, perform data transformation on the first function, combine the identity data to form header data, and jointly store the header data and tail data. Specifically, it includes: obtaining the identity data of the tail data and the corresponding first function, encoding it into a binary string of a preset length, and then converting it into a decimal string. Each batch of detection data corresponds to one first function, and multiple first functions corresponding to the detection data obtained from multiple batches are converted into decimal strings. Based on the multiple collection batch serial numbers and their corresponding decimal strings, a second function is constructed. The decimal string corresponding to the first function is used as the input variable to the second function to generate the hidden data corresponding to the first function. The hidden data is combined with the identity data to obtain the header data. The header data is then integrated with the tail data and stored.
4. The data encryption and storage system for a gas detector according to claim 3, characterized in that, The identification data includes at least the collection time interval corresponding to the gas detector data packet.
Citation Information
Patent Citations
Lightweight data storage device and method suitable for graph block chain
CN113641664A
Security data management system based on space-time encryption
CN118395469A