Data management method, device and control chip for embedded flash memory

By configurable operation of the check data position insertion logic in Hamming code encoding, the security problem of fixed check code position in Hamming code encryption is solved, and the data confidentiality and reliability of embedded flash memory are improved.

CN114490452BActive Publication Date: 2025-09-19SHENZHEN YSPRING TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210118615.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-02-08
Publication Date
2025-09-19
Estimated Expiration
2042-02-08

AI Technical Summary

Technical Problem

In the existing Hamming code encryption method, the position of the check code is fixed, resulting in low data security and easy to be stolen and decrypted.

Method used

By configurable operations on the check data position insertion logic in the Hamming code, the check data is no longer fixed at the data bits corresponding to the Nth power of 2, but is specified or dynamically configured by the user and encrypted in combination with the Hamming code principle.

Benefits of technology

It improves the confidentiality of data and increases the difficulty of decryption, while maintaining the reliability of data writing and reading.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114490452B_ABST
    Figure CN114490452B_ABST
Patent Text Reader

Abstract

The present invention provides a data management method, device, and control chip for embedded flash memory. The method comprises: obtaining valid data to be stored and an encryption configuration instruction; determining the position insertion logic of the verification data based on the encryption configuration instruction, and generating the verification data based on Hamming encoding using the position insertion logic and the valid data; inserting the verification data into the valid data according to the position insertion logic to obtain encrypted combined data; and storing the encrypted combined data in the embedded flash memory in association with the encryption-related information. By configuring the position insertion logic of the verification data in the Hamming encoding, the method can significantly improve the confidentiality of the stored data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of data storage, and in particular to a data management method, device, and control chip for embedded flash memory. Background Art

[0002] Flash memory, as a non-volatile memory, can be used to store program code and data, for example. It is widely used in various applications, including microprocessor (MCU) chip design, where it is also called embedded flash memory (eFlash). The stability and security of data in eFlash require more effective protection. Existing encryption methods typically include Hamming code encryption. However, the position of the encrypted checksum is always fixed in Hamming code encryption, making it easy to decrypt the data once it is stolen, resulting in low data security. Summary of the Invention

[0003] In view of this, embodiments of the present application provide a data management method, device, and control chip for an embedded flash memory.

[0004] In a first aspect, an embodiment of the present application provides a data management method for an embedded flash memory, comprising:

[0005] Obtain valid data and encryption configuration instructions to be stored;

[0006] Determine the position insertion logic of the verification data according to the encryption configuration instruction, and generate the verification data based on Hamming coding using the position insertion logic and the valid data;

[0007] Inserting the verification data into the valid data according to the position insertion logic to obtain encrypted combined data;

[0008] The encrypted combined data and the encryption related information are associated and stored in the embedded flash memory.

[0009] In some embodiments, the data management method for embedded flash memory further includes:

[0010] Reading the encrypted combined data and the associated encryption related information, and determining the position insertion logic corresponding to the encrypted combined data according to the encryption related information;

[0011] The encrypted combined data is Hamming decrypted according to the position insertion logic to obtain the valid data.

[0012] In some embodiments, the position insertion logic includes an insertion position of each check code in the check data in the encrypted combined data to be solved, and generating the check data based on Hamming coding using the position insertion logic and the valid data includes:

[0013] According to the insertion position of each check code, the encrypted combined data to be solved is obtained, which is composed of multiple unknown check codes and the valid data;

[0014] Obtaining a binary index of each data bit in the encrypted combined data to be solved;

[0015] The encrypted combination data to be solved is grouped based on binary indices according to a rule that each group contains only one unknown check code, to obtain multiple groups;

[0016] The values ​​of the unknown check codes in each group are determined according to the rule that the number of "1"s in each group is an even number, and the check codes with known values ​​together constitute the check data.

[0017] In some embodiments, each position insertion logic does not include more than two check codes inserted in the same position; the position insertion logic does not include N The corresponding data bits are respectively inserted with check codes, where N is an integer greater than or equal to 0.

[0018] In some embodiments, the number of bits of the check data and the number of bits of valid data to be stored satisfy the following relationship:

[0019] 2 r >=n+1;

[0020] Wherein, r represents the minimum number of bits required for the check code, and n represents the number of bits of the valid data.

[0021] In some embodiments, the correspondence between the insertion logic at different positions of the verification data and different encryption configuration instructions is implemented by a programmable logic device.

[0022] In a second aspect, an embodiment of the present application further provides a data management device for an embedded flash memory, comprising:

[0023] An acquisition module, used to obtain valid data and encryption configuration instructions to be stored;

[0024] A verification generation module, configured to determine a position insertion logic for the verification data according to the encryption configuration instruction, and generate the verification data using the position insertion logic and the valid data based on Hamming coding;

[0025] an encryption and reassembly module, configured to insert the verification data into the valid data according to the position insertion logic to obtain encrypted combined data;

[0026] The storage module is used to associate the encrypted combined data with the encryption related information and store them in an embedded flash memory.

[0027] In some embodiments, the data management device for embedded flash memory further includes:

[0028] a reading module, configured to read the encrypted combined data and the encryption-related information, and determine the position insertion logic corresponding to the encrypted combined data according to the encryption-related information;

[0029] A data decryption module is used to perform Hamming decryption on the combined data according to the position insertion logic to obtain the valid data.

[0030] In a third aspect, an embodiment of the present application also provides a control chip comprising an embedded flash memory, a memory and a processor, wherein the embedded flash memory is used to access encrypted combined data, the memory is used to store a computer program, and when the computer program runs on the processor, the control chip executes the above-mentioned data management method for embedded flash memory.

[0031] In a fourth aspect, an embodiment of the present application further provides a readable storage medium storing a computer program, which, when executed on a processor, implements the above-mentioned data management method for embedded flash memory.

[0032] The embodiments of the present application have the following beneficial effects:

[0033] The data management method for embedded flash memory of the embodiment of the present application obtains valid data to be stored and encryption configuration instructions; then, based on the encryption configuration instructions, determines the position insertion logic of the verification data, and generates the verification data based on Hamming coding using the position insertion logic and the valid data; finally, inserts the verification data into the valid data according to the position insertion logic to obtain encrypted combined data; and associates the encrypted combined data with encryption-related information and stores it in the embedded flash memory. This method configurably operates the position insertion logic of the verification data in the Hamming coding, and still encrypts data based on the principle of Hamming coding. In this way, without modifying the original Hamming coding logic, since the verification code is no longer in the original fixed position, the difficulty of cracking it during the decryption process is increased, thereby greatly improving the confidentiality of the stored data and more effectively ensuring the reliability of data writing and reading. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can be obtained based on these drawings without creative work.

[0035] Figure 1 A first flow chart of a data management method for an embedded flash memory according to an embodiment of the present application is shown;

[0036] Figure 2 A flow chart showing verification data generation according to an embodiment of the present application is shown;

[0037] Figure 3 A system architecture diagram showing a data management method for embedded flash memory according to an embodiment of the present application is shown;

[0038] Figure 4 A second flow chart of the data management method for embedded flash memory according to an embodiment of the present application is shown;

[0039] Figure 5 A first structural diagram of a data management device for an embedded flash memory according to an embodiment of the present application is shown;

[0040] Figure 6 A second structural diagram of a data management device for an embedded flash memory according to an embodiment of the present application is shown;

[0041] Figure 7 A schematic structural diagram of a control chip according to an embodiment of the present application is shown. DETAILED DESCRIPTION

[0042] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments.

[0043] The components of the embodiments of the present application generally described and illustrated in the drawings herein may be arranged and designed in a variety of different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the claimed application, but rather merely represents selected embodiments of the present application. All other embodiments obtained by those skilled in the art based on the embodiments of the present application without creative effort are within the scope of protection of the present application.

[0044] Hereinafter, the terms "including", "having" and their cognates, which may be used in various embodiments of the present application, are intended only to indicate specific features, numbers, steps, operations, elements, components or combinations of the foregoing items, and should not be understood as first excluding the existence of one or more other features, numbers, steps, operations, elements, components or combinations of the foregoing items or the possibility of adding one or more features, numbers, steps, operations, elements, components or combinations of the foregoing items.

[0045] Furthermore, the terms “first,” “second,” “third,” etc., are merely used for distinguishing descriptions and are not to be understood as indicating or implying relative importance.

[0046] Unless otherwise defined, all terms used herein (including technical and scientific terms) have the same meaning as commonly understood by those skilled in the art to which the various embodiments of the present application belong. The terms (such as those defined in generally used dictionaries) will be interpreted as having the same meaning as in the context of the relevant technical field and will not be interpreted as having an idealized meaning or an overly formal meaning unless clearly defined in the various embodiments of the present application.

[0047] The existing Hamming code encoding algorithms are all based on the power of 2N (i.e. 2 N ) are inserted into each check code in sequence, where N is an integer greater than or equal to 0. Specifically, the first bit in the combined data (i.e., corresponding to 2 0 ), the second position (corresponding to 2 1 ), the 4th position (corresponding to 2 2 ), the 8th bit (corresponding to 2 3 ) and the 16th bit (corresponding to 2 4 ) and other positions. These checksums can be used to encrypt the valid data and correct any single-bit errors. Existing Hamming codes insert checksums at fixed positions, making it easy for someone to recover the original valid data and steal the information if they obtain the encrypted data.

[0048] To this end, embodiments of the present application propose a data management method for embedded flash memory. Based on the principles of Hamming code encoding, this method implements configurable logic for inserting checksum data into the data bits, eliminating the need for fixed positions corresponding to powers of 2. Instead, these checksums can be specified by the user or dynamically configured. While decryption still utilizes Hamming code, the specific locations of these checksums are unknown to others, significantly increasing the difficulty of decryption. This improvement in existing Hamming code encoding enhances the confidentiality of stored data. This data management method for embedded flash memory is described in detail below.

[0049] Please refer to Figure 1 The embodiment of the present application proposes a data management method for embedded flash memory, which can be applied to data access of microprocessor (MCU) chips, system on chip (SoC) chips, etc.

[0050] Exemplarily, the data management method for embedded flash memory includes steps S110 to S140:

[0051] S110, obtaining valid data to be stored and encryption configuration instructions.

[0052] In this embodiment, based on the principle of Hamming code encoding, the insertion position of the check data in the Hamming code is configurable, and then re-encoding is performed using the configured insertion position logic that is different from the insertion position rules of traditional Hamming code encoding to generate these check data.

[0053] The aforementioned encryption configuration instructions correspond one-to-one with the location insertion logic for the verification data used to encrypt valid data, i.e., one location insertion logic corresponds to one encryption configuration instruction. For example, a control chip may store multiple location insertion logics, and the user may select one for encrypted storage based on storage needs, or may switch to a different logic for encryption at regular intervals, thereby improving the security of stored data. It is understood that the aforementioned correspondence can be pre-stored so that when encrypting actual valid data, the location insertion logic for this storage operation can be determined based on the input encryption configuration instructions.

[0054] For example, in one embodiment, the number of bits in the configuration field of the encrypted configuration instruction can be determined based on the number of position insertion logics. For example, when there are three or four position insertion logics, the configuration field sel can be represented by two bits (i.e., sel[1:0]). For example, sel=00 selects the first position insertion logic; sel=01 selects the second position insertion logic; and so on. It is understood that if there are at least five position insertion logics, the configuration field can be represented by more bits.

[0055] It is understood that the number of bits of the check data in this embodiment is related to the number of bits of the valid data to be stored. For example, in one embodiment, the number of bits of the check data and the number of bits of the valid data to be stored may satisfy the following relationship:

[0056] 2 r >=n+1;

[0057] Where r is the minimum number of bits required for the check code, and n is the number of bits of valid data.

[0058] For example, when the valid data is 16 bits, at least 5 check bits are required; when the valid data is 32 bits, at least 6 check bits are required; when the valid data is 64 bits, at least 9 check bits are required, and so on. It is understood that the number of bits of valid data is not limited to an even number, but can also be an odd number such as 7, 13, 15, or 31 bits, and this is not limited here. It is understood that the total number of bits in the encrypted combined data is equal to the sum of the number of bits of valid data and the minimum number of bits required for the check bits.

[0059] S120 , determining the position insertion logic of the verification data according to the encryption configuration instruction, and generating verification data based on Hamming coding using the position insertion logic and valid data.

[0060] For example, since there is a correspondence between the encryption configuration instructions and the insertion logic of the verification data, once the encryption configuration instructions are known, the insertion logic can be determined by querying this correspondence. Furthermore, based on the insertion positions of these verification codes, the specific values ​​of each verification code can be further calculated using the encoding principle of Hamming code.

[0061] For example, if the number of bits of valid data to be stored is 32 and the number of bits of check data is 6, for the 38-bit combination data to be solved, the logic for inserting the check data at different positions can include multiple types, for example, 8 types are listed below, where each scheme is different.

[0062] The first option: insert a check code at the 1st, 2nd, 11th, 12th, 21st and 22nd positions respectively; the second option: insert a check code at the 3rd, 4th, 13th, 14th, 23rd and 24th positions respectively; the third option: insert a check code at the 5th, 6th, 15th, 16th, 25th and 26th positions respectively; the fourth option: insert a check code at the 7th, 8th, 17th, 18th, 27th and 28th positions respectively; the fifth option: insert a check code at the 9th, 10th, 19th, 20th, 29th and 30th positions respectively; the sixth option: insert a check code at the 11th, 12th, 21st, 22nd, 31st and 32nd positions respectively; the seventh option: insert a check code at the 13th, 14th, 23rd, 24th, 33rd and 34th positions respectively; the eighth option: insert a check code at the 15th, 16th, 25th, 26th, 35th and 36th positions respectively.

[0063] It is understood that the above eight position insertion logics of inserting continuously at two adjacent positions of the interval are only some feasible examples. In addition, it is also possible to insert a check code after each corresponding data bit, that is, discontinuous insertion, etc. The user can select randomly or specify it according to needs, and there is no limitation here. Generally, each position insertion logic does not allow more than two check codes to be inserted continuously at the same position. In addition, these position insertion logics are usually not included in 2 N The corresponding data bits are inserted into each bit of the check code respectively, which is different from the traditional position insertion rule.

[0064] Among them, the correspondence between the different position insertion logics of the above-mentioned verification data and the different encryption configuration instructions can be implemented through software or hardware. For example, if it is implemented through hardware, a programmable logic device, such as a programmable logic array (PLA), can be used to input different encryption configuration instructions to select different position insertion logic.

[0065] In one embodiment, Figure 2 As shown, the process of obtaining the values ​​of each check code in the verification data may include the following sub-steps S210 to S240:

[0066] S210 , obtaining encrypted combined data to be solved, which is composed of multiple unknown check codes and valid data, according to the insertion position of each check code.

[0067] S220: Obtain a binary index of each data bit in the encrypted combined data to be solved.

[0068] S230 , grouping the encrypted combined data to be solved based on the binary index according to the rule that each group contains only one unknown check code, to obtain multiple groups.

[0069] S240 , determining the value of the unknown check code in each group according to the rule that the number of “1” in each group is an even number, and the check codes with known values ​​together constitute the check data.

[0070] like Figure 3 As shown, taking the encryption scenario of 32-bit valid data as an example, it can be determined that the minimum number of bits of the check code data is 6 bits. Therefore, the total number of bits of the encrypted combination data to be solved is 38 bits, represented here as D0 to D37. The second solution of the eight position insertion logic is used for illustration. That is, inserting an unknown check code X at positions D2, D3, D12, D13, D22, and D23 respectively, can obtain the encrypted combination data to be solved.

[0071] Then, according to the binary index of each data bit, that is, using multiple binary bits to represent the sequence number of each data bit, since the number of bits of the combined data is 38, it can be represented by six binary bits. For example, the binary index of D0 is 000001, the binary index of D1 is 000010, and so on. The binary index of D38 is 100100.

[0072] Therefore, these binary indices are divided according to the rule that each group contains only one unknown check code. For example, for the first group P1, the binary index of the data bits it contains satisfies xxxxx1; for the second group P2, the binary index of the data bits it contains satisfies xxxx1x; and so on. This results in six groups P1 to P6, where each unknown check code is divided into the corresponding group. Then, using the rule that the number of "1"s in all data in the same group must be an even number, it is possible to determine whether the value of the unknown check code in that group is 1 or 0. Thus, the current check data is obtained.

[0073] S130: Insert the generated verification data into the valid data according to the position insertion logic to obtain encrypted combined data.

[0074] Exemplarily, after determining the specific value of the verification data this time, these verification codes can be used to encrypt the valid data, that is, these verification codes are inserted into the corresponding positions according to the above-mentioned position insertion logic to obtain the encrypted combination data for encrypting the valid data, and then execute step S140.

[0075] S140: The encrypted combined data is associated with the encryption-related information and stored in the embedded flash memory.

[0076] Among them, the above encryption-related information can be a specific encryption configuration instruction, an index of the current position insertion logic, or other data that can be used to reflect the association between the current position input logic and the current valid data, etc., which is not limited here.

[0077] Exemplarily, after obtaining the encrypted combination data, it can be associated with the information related to this encryption, and then these data can be stored in the embedded flash memory, so that after reading the encrypted combination data later, the encryption-related information can be obtained at the same time, and then the encryption-related information can be used for decryption to restore the original valid data.

[0078] As an optional solution, after the valid data is encrypted and stored, if the original valid data needs to be obtained, it also involves the process of reading the data from the flash memory and decrypting it. Figure 4 , exemplary, the data management method for embedded flash memory further includes the following steps S150 to S160:

[0079] S150, reading the above-mentioned encrypted combination data and the associated encryption-related information, and determining the position insertion logic corresponding to the encrypted combination data according to the encryption-related information.

[0080] S160, perform Hamming decryption on the encrypted combined data according to the position insertion logic to obtain the above-mentioned valid data. It can be understood that the Hamming decryption operation is closely related to the above-mentioned Hamming encryption operation. Figure 3 As shown, by obtaining the original encrypted position insertion logic, the values ​​of these check codes can be determined, and then according to the principle of Hamming code decryption, the unencrypted valid data can be restored.

[0081] Furthermore, if any single bit of the combined data is erroneous, it will not affect the actual valid data. This is because the error correction properties of the Hamming code can correct any single bit of erroneous data. However, if multiple bits of data are erroneous, the correctness of the valid data cannot be guaranteed.

[0082] The data management method for embedded flash memory in the embodiment of the present application performs configurable operations by inserting logic into the position of the check data in the Hamming code, and still encrypts the data based on the principle of Hamming code. This can increase the difficulty of cracking the data when it is leaked without modifying the original Hamming code logic, thereby greatly improving the confidentiality of the stored data. Moreover, based on the logic of Hamming code, it can more effectively ensure the reliability of data writing and reading.

[0083] Please refer to Figure 5 Based on the data management method for embedded flash memory of the above embodiment, this embodiment proposes a data management device 100 for embedded flash memory. Exemplarily, the data management device 100 for embedded flash memory includes:

[0084] An acquisition module 110 is used to acquire valid data and encryption configuration instructions to be stored;

[0085] The verification generation module 120 is configured to determine the position insertion logic of the verification data according to the encryption configuration instruction, and generate the verification data based on Hamming coding using the position insertion logic and the valid data;

[0086] an encryption reassembly module 130, configured to insert the verification data into the valid data according to the position insertion logic to obtain encrypted combined data;

[0087] The storage module 140 is configured to associate the encrypted combined data with the encryption-related information and store them in an embedded flash memory.

[0088] Furthermore, if Figure 6 As shown, the data management device 100 for embedded flash memory further includes:

[0089] a reading module 150, configured to read the encrypted combined data and the encryption-related information, and determine the position insertion logic corresponding to the encrypted combined data according to the encryption-related information;

[0090] The data decryption module 160 is configured to perform Hamming decryption on the combined data according to the position insertion logic to obtain the valid data.

[0091] It can be understood that the apparatus of this embodiment corresponds to the method of the above embodiment, and the options in the above embodiment are also applicable to this embodiment, so they will not be described again here.

[0092] Please refer to Figure 7 The present application also provides a control chip, which may be, for example, an MCU (microprocessor) chip, an SoC (system on chip) chip, etc. Exemplarily, the control chip includes an embedded flash memory (also known as eFlash), a processor, and a memory, wherein the embedded flash memory is used to store and access the encrypted combined data, and the memory stores a computer program. The processor runs the computer program, thereby enabling the control chip to execute the functions of the various modules in the above-mentioned data management method for embedded flash memory or the above-mentioned data management device for embedded flash memory.

[0093] The present application also provides a readable storage medium for storing the computer program used in the above-mentioned control chip.

[0094] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and structure diagrams in the accompanying drawings show the possible architectures, functions and operations of the devices, methods and computer program products according to the multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of the code, and the module, program segment or a part of the code contains one or more executable instructions for implementing the specified logical functions. It should also be noted that in an alternative implementation, the functions marked in the box can also occur in an order different from that marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the structure diagram and / or flowchart, and the combination of boxes in the structure diagram and / or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or action, or can be implemented using a combination of dedicated hardware and computer instructions.

[0095] In addition, the functional modules or units in the various embodiments of the present application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.

[0096] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling a computer device (which can be a smart phone, a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0097] The above is only a specific implementation method of the present application, but the scope of protection of the present application is not limited thereto. Any technician familiar with this technical field can easily think of changes or replacements within the technical scope disclosed in this application, which should be covered by the scope of protection of the present application.

Claims

1. A data management method for embedded flash memory, characterized in that: include: Obtain valid data and encryption configuration instructions to be stored; Determine the position insertion logic of the verification data according to the encryption configuration instruction, and generate the verification data based on Hamming coding by using the position insertion logic and the valid data; wherein, the position insertion logic includes the insertion position of each verification code in the verification data in the encrypted combination data to be solved, and the position insertion logic does not include the insertion position of each verification code in the encrypted combination data to be solved in 2 N The corresponding data bits are respectively inserted with the check code, where N is an integer greater than or equal to 0; Inserting the verification data into the valid data according to the position insertion logic to obtain encrypted combined data; storing the encrypted combined data and the encryption related information in association with each other in an embedded flash memory; The method of generating the verification data by utilizing the position insertion logic and the valid data based on Hamming coding includes: obtaining encrypted combination data to be solved composed of multiple unknown check codes and the valid data according to the insertion position of each check code; obtaining a binary index for each data bit in the encrypted combination data to be solved; grouping the encrypted combination data to be solved based on the binary index according to the rule that each group contains only one unknown check code, thereby obtaining multiple groups; and determining the value of the unknown check code in each group according to the rule that the number of "1"s in each group is an even number, wherein the check codes with known values ​​together constitute the verification data.

2. The data management method for embedded flash memory according to claim 1, characterized in that: Also includes: Reading the encrypted combined data and the associated encryption related information, and determining the position insertion logic corresponding to the encrypted combined data according to the encryption related information; The encrypted combined data is Hamming decrypted according to the position insertion logic to obtain the valid data.

3. The data management method for embedded flash memory according to claim 1, characterized in that: For each position insertion logic, no more than two check codes are inserted continuously at the same position.

4. The data management method for embedded flash memory according to any one of claims 1 to 3, characterized in that: The number of bits of the verification data and the number of bits of the valid data to be stored satisfy the following relationship: 2 r >= n + 1; Wherein, r represents the minimum number of bits required for the check code, and n represents the number of bits of the valid data.

5. The data management method for embedded flash memory according to claim 1, characterized in that: The correspondence between the insertion logic at different positions of the verification data and different encryption configuration instructions is realized by a programmable logic device.

6. A data management device for embedded flash memory, characterized in that: include: An acquisition module, used to obtain valid data and encryption configuration instructions to be stored; The verification generation module is used to determine the position insertion logic of the verification data according to the encryption configuration instruction, and generate the verification data based on the Hamming code by using the position insertion logic and the valid data; wherein, the position insertion logic includes the insertion position of each verification code in the verification data in the encrypted combination data to be solved, and the position insertion logic does not include the insertion position of the verification code in the 2 N The corresponding data bits are respectively inserted with the check code, where N is an integer greater than or equal to 0; The method of generating the verification data using the position insertion logic and the valid data based on Hamming coding includes: obtaining encrypted combined data to be solved, which is composed of multiple unknown verification codes and the valid data, based on the insertion position of each verification code bit; obtaining a binary index for each data bit in the encrypted combined data to be solved; grouping the encrypted combined data to be solved based on the binary indexes according to a rule that each group contains only one unknown verification code bit, thereby obtaining multiple groups; and determining the value of the unknown verification code in each group according to a rule that the number of "1"s in each group is an even number, wherein the verification codes with known values ​​collectively constitute the verification data. an encryption and reassembly module, configured to insert the verification data into the valid data according to the position insertion logic to obtain encrypted combined data; The storage module is used to associate the encrypted combined data with the encryption related information and store them in an embedded flash memory.

7. The data management device for embedded flash memory according to claim 6, characterized in that: Also includes: a reading module, configured to read the encrypted combined data and the encryption-related information, and determine the position insertion logic corresponding to the encrypted combined data according to the encryption-related information; A data decryption module is used to perform Hamming decryption on the combined data according to the position insertion logic to obtain the valid data.

8. A control chip, characterized in that: The method comprises an embedded flash memory, a memory and a processor, wherein the embedded flash memory is used to access encrypted combined data, the memory is used to store a computer program, and when the computer program runs on the processor, the control chip executes the data management method for the embedded flash memory according to any one of claims 1 to 5.

9. A readable storage medium, characterized in that The device stores a computer program, which, when executed on a processor, implements the data management method for an embedded flash memory according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • A memory circuit for realizing data error correction based on Hamming codes

    CN109766213A

  • Multi-region-based anti-counterfeiting code generation and verification method, system, equipment and medium

    CN113988242A