Tracing system and method based on tamper-proofing of grain inspection data
By designing a traceability system based on tamper-proof food inspection data, using coding and hashing technology, the problem of artificial influence of grain quality inspection results is solved, the objectivity and immutability of test results are achieved, and the efficiency and accuracy of grain quality inspection work are improved.
Patent Information
- Application Number
- CN202411939479.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-26
- Publication Date
- 2025-05-27
AI Technical Summary
The grain quality inspection results are greatly affected by manual labor, making it difficult to ensure the objectivity of the inspection results and prevent tampering.
Design a traceability system based on tamper-proof food inspection data. Through the sample coding module, the original data coding module, the report generation module and the report verification module, the encoding and hash value of the grain samples is generated and verified to ensure the authenticity and immutability of the test results.
It improves the objectivity and standardization of grain quality inspection results, ensures the authenticity and immutability of test results, realizes the full process automation, and improves the efficiency and accuracy of grain quality inspection work.
Smart Images

Figure CN120047162A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data security, and particularly to a traceability system and method for preventing tampering of grain inspection data. Background Art
[0002] Grain quality inspection includes quality indicators (including moisture, bulk density, impurities, etc.) and hygiene indicators (including toxins, heavy metals, etc.). There are many detection items, and most of them are detected by manual methods, recording data, and finally generating inspection reports. The inspection results are greatly affected by human subjectivity. How to improve the objectivity of grain quality inspection work, reduce "favoritism in grain inspection", and ensure that the detection results are true and not tampered with has always been the focus of the industry's progress. Summary of the Invention
[0003] In view of the above technical problems, the present invention provides a traceability system and method for preventing tampering of grain inspection data. The system includes:
[0004] A sample coding module, an original data coding module, a report generation module, and a report verification module;
[0005] The sample coding module generates an original sample code for the grain sample to be detected; after mixing and sub-sampling the grain sample, a sub-sample code of the grain sample is generated based on the sub-sample number of the original sample code;
[0006] The original data coding module generates an original data code of the grain sample based on the sub-sample code of the grain sample and the original data of the grain sample detection items; the original data is subjected to hash calculation to generate an original data hash value;
[0007] The report generation module is used to generate a grain detection report according to the original data of the grain sample detection items; an inspection report code of the grain sample is generated based on the original data code, the grain detection report type code, and the original data hash value;
[0008] The report verification module is used to generate a grain detection report hash value by performing hash calculation on the data content of the grain detection report; if the original data hash value is consistent with the grain detection report hash value, it is confirmed that the grain inspection data has not been tampered with.
[0009] Furthermore, the original sample code is specifically:
[0010] Business number + variety code + serial number + timestamp.
[0011] Furthermore, after mixing and sub-sampling the grain sample, generating a sub-sample code of the grain sample based on the sub-sample number of the original sample code includes:
[0012] Obtain the sub-sample number of the original sample code by scanning the code or inputting it.
[0013] Based on the sub-sample number of the original sample code, generate the sub-sample code of the grain sample as: original sample code hash value + sub-sample number + weight + timestamp + QR code.
[0014] Furthermore, the original data coding module generates the original data code of the grain sample based on the sub-sample code of the grain sample and the original data of the grain sample test items, specifically as follows:
[0015] Original data code: sub-sample code + test item code + serial number + timestamp.
[0016] Furthermore, based on the original data code, the grain test report type code, and the original data hash value, generate the inspection report code of the grain sample, specifically as follows:
[0017] Inspection report code: original data code + report type code + serial number + original data hash value + timestamp.
[0018] Furthermore, the report verification module is used to generate the grain test report hash value by performing hash calculation on the data content of the grain test report; if the original data hash value is consistent with the grain test report hash value, it is confirmed that the grain inspection data has not been tampered with, including:
[0019] Perform 32-bit hash value calculation on the data content of the grain test report to generate the grain test report hash value;
[0020] Compare the original data hash value in the test report code with the grain test report hash value. If they are consistent, it is determined that the grain inspection data has not been tampered with and the data is true and valid;
[0021] If they are inconsistent, it is determined that the grain inspection data has not been tampered with.
[0022] A traceability method based on preventing tampering of grain inspection data provided by the present invention includes:
[0023] Generate an original sample code for the grain sample to be tested; after mixing and sub-sampling the grain sample, generate the sub-sample code of the grain sample based on the sub-sample number of the original sample code;
[0024] Generate the original data code of the grain sample based on the sub-sample code of the grain sample and the original data of the grain sample test items; perform hash calculation on the original data to generate the original data hash value;
[0025] Generate a grain inspection report based on the original data of the grain sample inspection items; generate an inspection report code for the grain sample based on the original data code, the grain inspection report type code, and the original data hash value; generate a grain inspection report hash value by performing a hash calculation on the data content of the grain inspection report; if the original data hash value is the same as the grain inspection report hash value, confirm that the grain inspection data has not been tampered with.
[0026] Further, the original sample code is specifically:
[0027] Business number + variety code + serial number + timestamp.
[0028] Further, after the grain sample is mixed and sub-sampled, generate a sub-sample code for the grain sample based on the sub-sample number of the original sample code, including:
[0029] Obtain the sub-sample number of the original sample code by scanning the code or inputting it;
[0030] Generate the sub-sample code for the grain sample based on the sub-sample number of the original sample code as: original sample code hash value + sub-sample number + weight + timestamp + QR code.
[0031] Further, generate an inspection report code for the grain sample based on the original data code, the grain inspection report type code, and the original data hash value, specifically:
[0032] Inspection report code: original data code + report type code + serial number + original data hash value + timestamp.
[0033] A traceability system and method for preventing tampering with grain inspection data provided by the present invention uses sub-sample coding to separate inspection and business, can improve the objectivity and standardization of grain quality inspection results, uses an overall coding system, thereby improving the efficiency and accuracy of grain quality inspection work, and truly realizes full-process automation. The traceable and verifiable coding rules solve practical problems such as low efficiency, easy cheating, and chaotic data in grain purchase and storage. Ensure that the grain detection results are true and not tampered with. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] Figure 1 is a structural diagram of a traceability system for preventing tampering with grain inspection data provided by an embodiment of the present invention;
[0035] Figure 2 is a flow schematic diagram of a traceability method for preventing tampering with grain inspection data provided by an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0036] In the following description, many specific details are set forth in order to provide a thorough understanding of the present invention. However, the present invention can be implemented in many other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the connotation of the present invention. Therefore, the present invention is not limited by the specific implementations disclosed below.
[0037] The present invention provides a traceability system based on anti-tampering of grain inspection data, as Figure 1 shown, including: a sample coding module, an original data coding module, a report generation module, and a report verification module; ensuring that the inspector does not know the source of the sample, preventing "favoritism in grain inspection", generating an encrypted detection report code, ensuring that the detection results can be verified, and identifying data tampering behaviors. The system includes:
[0038] The sample coding module generates an original sample code for the grain sample to be detected; after the grain sample is mixed and sub-sampled, a sub-sample code of the grain sample is generated based on the sub-sample number of the original sample code.
[0039] The original data coding module generates an original data code of the grain sample based on the sub-sample code of the grain sample and the original data of the grain sample detection items; the original data is subjected to hash calculation to generate an original data hash value.
[0040] The report generation module is used to generate a grain detection report according to the original data of the grain sample detection items; an inspection report code of the grain sample is generated based on the original data code, the grain detection report type code, and the original data hash value.
[0041] The report verification module is used to generate a grain detection report hash value by performing hash calculation on the data content of the grain detection report; if the original data hash value is consistent with the grain detection report hash value, it is confirmed that the grain inspection data has not been tampered with.
[0042] 1. Sample coding module
[0043] The sample is taken manually or automatically, generates a business number from the grain informatization system or is manually recorded, generates an original sample code in this system, and generates a sub-sample code after mixing and sub-sampling. The inspector gets the sub-sampled sample and cannot know the sample source by scanning the code or entering the sub-sample code, thus avoiding "favoritism in grain inspection" to the greatest extent.
[0044] The original sample code is specifically:
[0045] Business number + variety code + serial number + timestamp.
[0046] Wherein:
[0047] Business number: The business number generated by the grain informatization system;
[0048] Variety code: See Appendix 1, "Variety Dictionary Table".
[0049] Serial number: Three digits, starting from 001.
[0050] Timestamp: Millisecond-level timestamp.
[0051] Based on the sub-sampling number of the original sample code, the sub-sampling code of the grain sample is generated as:
[0052] Hash value of the original sample code + sub-sampling number + weight + timestamp + QR code.
[0053] Wherein:
[0054] Hash value of the original sample code: Calculate the 32-bit hash value (MD5) of the original sample code.
[0055] Sub-sampling number: Two digits, starting from 01.
[0056] Weight: Usually 500, 100, 50, representing 500g, 100g, and 50g samples commonly used in grain inspection respectively.
[0057] Timestamp: Millisecond-level timestamp.
[0058] QR code: QR two-dimensional code.
[0059] Appendix 1: Variety Dictionary Table
[0060] Variety Encoding Wheat 01 Corn 02 Paddy 03 Soybean 04
[0061] 2. Original data coding module
[0062] Each piece of original data for each test by the inspector has a unique code. Original data code:
[0063] Sub-sampling code + test item code + serial number + timestamp
[0064] Wherein:
[0065] Sub-sampling code: "Sub-sampling code" mentioned above.
[0066] Test item code: See Appendix 2, "Test Item Dictionary Table".
[0067] Serial number: Four digits, starting from 0001.
[0068] Timestamp: Millisecond-level timestamp.
[0069] Appendix 2: Test Item Dictionary Table
[0070] Test Item Encoding Moisture 01 Volume Weight 02 Impurity 03 Immature Kernel 04 Rice Yield 05 Head Rice Rate 06 Yellow Rice Rate 07
[0071] 3. Report generation module
[0072] Each inspection report generated by the system has a unique code.
[0073] Inspection report code:
[0074] Original data code + Report type code + Serial number + Original data hash value + Timestamp.
[0075] Among them:
[0076] Original sample code: the "original data code" mentioned above;
[0077] Report type code: see Appendix 3: "Report Type Dictionary Table";
[0078] Serial number: three-digit number, starting from 001;
[0079] Original data hash value: all the original data included in this test report form an array, and a 32-bit hash value (MD5) is calculated;
[0080] Timestamp: millisecond-level timestamp.
[0081] Appendix 3: Report Type Dictionary Table
[0082] Report Type Encoding Purchase Quality Inspection 01 Warehouse Sealing Quality Inspection 02 Spring Inspection 03 Autumn Inspection 04 Temporary Inspection 05 Warehouse Outgoing Quality Inspection 06
[0083] 4. Report verification module
[0084] A visual report verification interface that supports calculating the hash value of a grain inspection report by calculating the 32-bit hash value of the data content of the grain inspection report; comparing the original data hash value in the inspection report code with the grain inspection report hash value. If they are the same, it is determined that the grain inspection data has not been tampered with and the data is true and valid; if they are different, it is determined that the grain inspection data has been tampered with.
[0085] Based on the same inventive concept, the present invention also provides a traceability method for preventing tampering of grain inspection data, the process of which is as Figure 2 shown, including:
[0086] Step S201: Generate an original sample code for the grain sample to be detected; after mixing and sub-sampling the grain sample, generate a sub-sample code for the grain sample based on the sub-sample number of the original sample code;
[0087] Step S202: Generate the original data code of the grain sample based on the sub-sample code of the grain sample and the original data of the grain sample detection items; calculate the hash value of the original data to generate the original data hash value;
[0088] Step S203: Generate a grain inspection report based on the original data of the grain sample inspection items; generate an inspection report code for the grain sample based on the original data code, the grain inspection report type code, and the original data hash value.
[0089] Step S204: Generate a grain inspection report hash value by performing a hash calculation on the data content of the grain inspection report; if the original data hash value is the same as the grain inspection report hash value, it is confirmed that the grain inspection data has not been tampered with.
[0090] Further, the original sample code is specifically:
[0091] Business number + variety code + serial number + timestamp.
[0092] Further, after the grain sample is mixed and sub-sampled, generate a sub-sample code for the grain sample based on the sub-sample number of the original sample code, including:
[0093] Obtain the sub-sample number of the original sample code by scanning the code or entering it.
[0094] Generate the sub-sample code for the grain sample based on the sub-sample number of the original sample code as: original sample code hash value + sub-sample number + weight + timestamp + QR code.
[0095] Further, generate the inspection report code for the grain sample based on the original data code, the grain inspection report type code, and the original data hash value, specifically:
[0096] Inspection report code: original data code + report type code + serial number + original data hash value + timestamp.
[0097] A traceability system and method for preventing tampering of grain inspection data provided by the present invention use the sub-sample code to separate inspection and business, which can improve the objectivity and standardization of grain quality inspection results, use the overall coding system, and then improve the efficiency and accuracy of grain quality inspection work, and truly realize full-process automation. The traceable and verifiable coding rules solve practical problems such as low efficiency, easy cheating, and chaotic data in grain purchase and storage.
[0098] Those skilled in the art should understand that the embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present invention can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0099] The present invention is described with reference to the flowcharts and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the present invention. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and combinations of flows and / or blocks in the flowcharts and / or block diagrams can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing device to produce a machine, such that the instructions executed by the processor of the computer or other programmable data processing device generate means for implementing the functions specified in one flow Figure 1 one flow or multiple flows and / or blocks Figure 1 or means for implementing the functions specified in multiple blocks.
[0100] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, such that the instructions stored in the computer-readable memory produce a manufactured article including instruction means for implementing the functions specified in one flow Figure 1 one flow or multiple flows and / or blocks Figure 1 or means for implementing the functions specified in multiple blocks.
[0101] These computer program instructions can also be loaded onto a computer or other programmable data processing device, such that a series of operation steps are executed on the computer or other programmable device to produce a computer-implemented process, and thus the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one flow Figure 1 one flow or multiple flows and / or blocks Figure 1 or means for implementing the functions specified in multiple blocks.
[0102] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit them. Although the present invention has been described in detail with reference to the above embodiments, those of ordinary skill in the art should understand that modifications or equivalent replacements can still be made to the specific embodiments of the present invention. Any modification or equivalent replacement without departing from the spirit and scope of the present invention shall be covered by the scope of the claims of the present invention.
Claims
1. A traceability system based on grain inspection data tamper-proof, characterized in that: include: Sample coding module, raw data coding module, report generation module and report verification module; The sample coding module generates the original sample code for the grain sample to be tested; After mixing and dividing the grain sample, generating a dividing code of the grain sample based on the dividing code of the original sample code; A raw data coding module generates a raw data code of the grain sample based on the sample sub-coding of the grain sample and the raw data of the grain sample detection item; The original data is subjected to hash calculation to generate a hash value of the original data; A report generation module, used to generate a grain test report according to the raw data of the grain sample test items; based on the raw data code, the grain test report type code and the raw data hash value, generate a grain sample inspection report code; A report verification module, used to generate a hash value of the grain inspection report by performing hash calculation on the data content of the grain inspection report; If the hash value of the original data is consistent with the hash value of the grain inspection report, it is confirmed that the grain inspection data has not been tampered with.
2. The system according to claim 1, characterized in that The original sample code is: Business number + product code + serial number + timestamp.
3. The system according to claim 1, characterized in that After the grain sample is mixed and divided, a sub-sample code of the grain sample is generated based on the sub-sample number of the original sample code, including: Obtain the sample number of the original sample code by scanning or entering the code; Based on the sample number of the original sample code, the sample code of the grain sample is generated as follows: original sample code hash value + sample number + weight + timestamp + QR code.
4. The system according to claim 1, characterized in that The original data coding module generates the original data coding of the grain sample based on the sample sub-coding of the grain sample and the original data of the grain sample detection item, specifically: Original data encoding: sample code + detection item code + serial number + timestamp.
5. The system according to claim 1, characterized in that Based on the original data code, the grain test report type code and the original data hash value, the inspection report code of the grain sample is generated, specifically: Inspection report code: original data code + report type code + serial number + original data hash value + timestamp.
6. The system according to claim 1, characterized in that A report verification module, used to generate a hash value of the grain inspection report by performing hash calculation on the data content of the grain inspection report; If the hash value of the original data is consistent with the hash value of the grain inspection report, it is confirmed that the grain inspection data has not been tampered with, including: The data content of the grain inspection report is calculated by 32-bit hash value to generate a hash value of the grain inspection report; Compare the hash value of the original data in the test report code with the hash value of the grain test report. If they are consistent, it is determined that the grain inspection data has not been tampered with and the data is authentic and valid; If there is any inconsistency, it is determined that the grain inspection data has not been tampered with.
7. A tamper-proof traceability method based on grain inspection data, characterized in that: include: Generate original sample codes for grain samples to be tested; After mixing and dividing the grain sample, generating a dividing code of the grain sample based on the dividing code of the original sample code; Generate an original data code of the grain sample based on the sample sub-code of the grain sample and the original data of the detection item of the grain sample; The original data is subjected to hash calculation to generate a hash value of the original data; Generate a grain test report based on the raw data of the grain sample test items; generate a grain sample inspection report code based on the raw data code, the grain test report type code and the raw data hash value; The data content of the grain inspection report is subjected to hash calculation to generate a hash value of the grain inspection report; If the hash value of the original data is consistent with the hash value of the grain inspection report, it is confirmed that the grain inspection data has not been tampered with.
8. The method according to claim 7, characterized in that The original sample code is: Business number + product code + serial number + timestamp.
9. The method according to claim 7, characterized in that: After the grain sample is mixed and divided, a sub-sample code of the grain sample is generated based on the sub-sample number of the original sample code, including: Obtain the sample number of the original sample code by scanning or entering the code; Based on the sample number of the original sample code, the sample code of the grain sample is generated as follows: original sample code hash value + sample number + weight + timestamp + QR code.
10. The method according to claim 7, characterized in that Based on the original data code, the grain test report type code and the original data hash value, the inspection report code of the grain sample is generated, specifically: Inspection report code: original data code + report type code + serial number + original data hash value + timestamp.
Citation Information
Cited By
Building material planning management system based on BIM technology
CN121212971A