Agricultural product comprehensive sales information tracing method and system

By adopting a symmetric encryption method for agricultural product source information and using character sequences, numeric sequences, mobile sequences and symbol sequences for encryption, the problem of slow asymmetric encryption algorithm is solved, and the speed and credibility of traceability of agricultural product information is improved.

CN119398802AActive Publication Date: 2025-02-07YUNNEX TECH +1
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202510008622.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-03
Publication Date
2025-02-07
Estimated Expiration
2045-01-03

AI Technical Summary

Technical Problem

In the prior art, the speed of encrypting and decrypting the comprehensive sales information of agricultural products using asymmetric encryption algorithms is slow, which affects the traceability speed of agricultural products' comprehensive sales information.

Method used

A symmetric encryption-based method is used to encrypt the source information of agricultural products. Specific steps include constructing a character sequence, converting source information into a numeric sequence, constructing a moving sequence and a symbol sequence, and encrypting the numeric sequence based on these sequences.

Benefits of technology

It improves the speed and credibility of traceability of comprehensive sales information of agricultural products. The encryption results have an avalanche effect and are difficult to crack by attackers, ensuring the confidentiality and security of information.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119398802A_ABST
    Figure CN119398802A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of information tracing, in particular to an agricultural product comprehensive sales information tracing method and system. The method comprises the steps that the agricultural product tracing platform encrypts source information of agricultural products and returns an encryption result to a consumer, and the encryption process comprises the steps that the source information is converted into a digital sequence; the method comprises the following steps of: constructing a character sequence, a moving sequence and a symbol sequence, and encrypting the digital sequence, namely converting a # imgabs1 # number # imgabs2 # number in the digital sequence into a # imgabs3 # number with a symbol according to a # imgabs0 # element in the symbol sequence, and when the # imgabs4 # number, taking an element with an index of # imgabs5 # in the character sequence as a ciphertext # imgabs7 # of # imgabs6 #, and taking the # imgabs8 # as the length of the character sequence; and obtaining an update index # imgabs10 # of the # imgabs9 # according to the moving sequence, and updating the character sequence according to the # imgabs11 #. The method is complex in encryption result, has an avalanche effect, can resist statistical analysis attacks and brute force attack attacks, and improves the credibility of agricultural product sales information traceability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of information traceability, and in particular to a method and system for tracing the comprehensive sales information of agricultural products. Background Art

[0002] Traditional agricultural product sales often lack transparency, and consumers cannot effectively confirm the source, production process, and quality and safety of the products, which not only affects consumers' purchasing decisions, but also increases the risk of counterfeit and shoddy products. Therefore, there is an urgent need for a highly operational agricultural product sales information traceability method to protect consumers' rights and interests and food safety.

[0003] The Chinese patent document with publication number CN114757685A discloses a method and system for safe traceability of grapefruit agricultural product processing, including: the encrypted signature device uses the private key of the encrypted signature to sign the traceability information, and uses the session key of the day to encrypt the signature and traceability information of the traceability information, and then returns the encrypted signature and traceability information of the traceability information to the enterprise device and reports it to the traceability center; the traceability center uses the session key of the day to decrypt the encrypted signature and traceability information of the traceability information, and uses the public key of the encrypted signature to verify the signature based on the elliptic curve; consumers scan the traceability QR code through the mobile terminal to obtain the traceability information of the product. The user APP performs encrypted query through the public key published by the traceability center, providing the authenticity of the source of the detection data.

[0004] Although the above methods can realize the information traceability of agricultural products, the encryption method used for the traceability information in the traceability process is an asymmetric encryption algorithm. The encryption and decryption speed of the asymmetric encryption algorithm is slow, the key length is large, and the key management is complex. It is only suitable for data encryption of small data volumes. The comprehensive sales information of agricultural products contains information on each link from agricultural product production, processing, transportation to sales. The data volume is large, and the encryption and decryption speed using asymmetric encryption algorithms is slow, which affects the traceability speed of the comprehensive sales information of agricultural products. Summary of the invention

[0005] In order to solve the problem that the speed of encrypting and decrypting comprehensive agricultural product sales information using an asymmetric encryption algorithm is slow, which affects the speed of tracing the comprehensive agricultural product sales information, the present invention provides a method and system for tracing the comprehensive agricultural product sales information.

[0006] In a first aspect, the present invention provides a method for tracing the source of comprehensive sales information of agricultural products, comprising the steps of: In response to the agricultural product traceability platform receiving the agricultural product information traceability request, the source information of the agricultural product is queried according to the identity code in the agricultural product information traceability request, the source information is encrypted, and the encryption result is returned to the consumer so that the consumer can view the source information; the encryption includes: constructing a character sequence, in which the elements in the character sequence are not repeated; converting the source information into a digital sequence; constructing a mobile sequence and a symbol sequence, in which each element in the mobile sequence is an integer whose size does not exceed the length of the character sequence, and the elements in the symbol sequence are 0 or 1, which are used to indicate positive or negative; encrypting each number in the digital sequence in turn to obtain the ciphertext of each number, which constitutes the encryption result of the source information, including: for the first number in the digital sequence, Numbers , the first Elements as The sign of the number with a sign , in response to , index the current character sequence as The elements as The ciphertext ; In response to , index the current character sequence as The elements as The ciphertext ,in Indicates the first Numbers The ciphertext the updated index in the current character sequence, is the length of the character sequence, % is the remainder symbol; get according to the moving sequence Update index in character sequence ,Will Move to the character sequence at index 's position to update the character sequence.

[0007] The effects are as follows: the present invention ensures the confidentiality of the source information of agricultural products during transmission by encrypting the source information of agricultural products; the encryption method in the present invention is symmetric encryption, which has a fast encryption speed and can improve the traceability speed of comprehensive sales data of agricultural products; the present invention uses the characters whose indexes in the character sequence are the same as the numbers in the digital sequence as the ciphertext of the numbers in the digital sequence, so that the ciphertext and the plaintext are completely different, which increases the complexity of the ciphertext, increases the difficulty for attackers to crack the encryption results of the source information, and improves the credibility of the traceability of agricultural product information; the present invention uses the updated index of the previous ciphertext and the next number in the digital sequence as the ciphertext of the number in the digital sequence, so that the ciphertext and the plaintext are completely different, which increases the complexity of the ciphertext, increases the difficulty for attackers to crack the encryption results of the source information, and improves the credibility of the traceability of agricultural product information; The ciphertext of the next number is obtained, so that the ciphertext of the next number is not only related to the next number, but also to the previous ciphertext, so that the encryption result of the source information has an avalanche effect, that is, changing a character in the plaintext source information will also cause a huge change in the encryption result, thereby destroying the statistical law between the plaintext and the ciphertext, and the encryption effect of the source information is better, and it can resist statistical analysis attacks; the present invention obtains the update index of each ciphertext according to the mobile sequence, updates the position of the ciphertext in the character sequence, makes the character sequence more chaotic, further improves the complexity of the ciphertext, and has a better encryption effect on the source information of agricultural products.

[0008] Preferably, the constructing of the character sequence includes: presetting the length of the character sequence ,in Need to meet ; Select from multiple different characters without replacement characters to form a character sequence.

[0009] Preferably, the converting the source information into a digital sequence comprises: encoding the data to be encrypted into a binary sequence, converting each binary sequence into a bits are divided into a binary string; all binary strings are converted into decimal numbers, each decimal number obtained is added by 1, and the results form a digital sequence.

[0010] The effect is that the present invention converts source information containing different data formats into a digital sequence in a unified format for encryption, which reduces the difficulty of encryption, improves the encryption speed, and can increase the traceability speed of comprehensive sales data of agricultural products.

[0011] Preferably, the step of obtaining according to the moving sequence Update index in character sequence , including: record the first element in the current move sequence as ,but The updated index in the character sequence is: , express The index before the update in the character sequence; get Update index in character sequence Afterwards, the first element in the moving sequence is removed from the moving sequence to achieve the update of the moving sequence.

[0012] The effect is that the present invention obtains the update index of each ciphertext according to the mobile sequence, so that the update position of each ciphertext has greater randomness, making the character sequence updated according to the update index more chaotic, thereby increasing the complexity of the encryption result of the source information.

[0013] Preferably, the step of obtaining according to the moving sequence Update index in character sequence , including: in response to ,Will As Update index in character sequence ,in is the first element in the current move sequence, express the index before the update in the character sequence; in response to ,like No. Candidate Update Index The damage degree is less than the preset damage threshold, and the No. Candidate Update Index ;like No. Candidate Update Index If the damage degree is not less than the preset damage threshold, Candidate Update Index As Update index in character sequence ,in is the number of moves in the current sequence. elements; Start with 1 and increase the value until you get Update index in character sequence Stop iteration when .

[0014] The effect is that the present invention determines the update index of each ciphertext according to the degree of damage, so that the update index of each ciphertext is as different as possible, further improving the confusion of the updated character sequence and ensuring the complexity of the encryption result of the source information.

[0015] Preferably, the degree of damage satisfies the expression: ;in, The first Numbers The ciphertext No. The degree of damage to the candidate update index; is the ordinal number of the number in the digital sequence, ; The first Numbers The ciphertext The updated index in the character sequence.

[0016] The effect is that the degree of destruction in the present invention not only takes into account the difference between the index of the ciphertext before updating in the character sequence and the candidate update index, but also takes into account the difference between the candidate update index and the update index of all previous ciphertexts, so that each ciphertext does not have a similar update rule, further increasing the confusion of the character sequence, improving the security of the encryption result of the source information, and making the traceability result of the comprehensive sales information of agricultural products more credible.

[0017] Preferably, the construction of the moving sequence includes: using the Logistic chaotic mapping algorithm to generate a length of A chaotic sequence, where is the length of the digital sequence; element values ​​to and Multiply and round up the result to get indivual Integer in the range, this indivual The sequence of integers in the range is used as the moving sequence, where is a hyperparameter, Parameter for the number of iterations in the second key.

[0018] Preferably, the method for constructing the symbol sequence is: using the Logistic chaotic mapping algorithm to generate a length of A chaotic sequence of Indicates the length of the digital sequence; element values ​​to Rounding to the nearest integer, we get integer, this The value of an integer is 0 or 1. The symbol sequence is a sequence of integers, where Parameter for the number of iterations in the third key.

[0019] In a second aspect, the present invention provides a system for tracing the source of comprehensive agricultural product sales information, comprising: a processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, the above-mentioned method for tracing the source of comprehensive agricultural product sales information is implemented.

[0020] By adopting the above technical solution, the above-mentioned agricultural product comprehensive sales information traceability method is generated into a computer program and stored in a memory to be loaded and executed by a processor, so that a terminal device is made based on the memory and the processor for easy use.

[0021] The present invention has the following technical effects: (1) The present invention has fast encryption speed, short key length, simple key management, and improves the traceability speed of comprehensive agricultural product sales data; (2) The key space in the present invention is large and can resist brute force attacks; (3) The ciphertext in the present invention is completely different from the plaintext, which increases the complexity of the ciphertext, increases the difficulty for attackers to crack the encrypted results of the source information, and improves the credibility of agricultural product information traceability; (4) The encryption result of the present invention has an avalanche effect, destroying the statistical law between plaintext and ciphertext, and can resist statistical analysis attacks; (5) The present invention continuously updates the character sequence during the encryption process, further improving the complexity of the ciphertext and achieving a better encryption effect on the source information of agricultural products. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] By reading the detailed description below with reference to the accompanying drawings, the above and other purposes, features and advantages of the exemplary embodiments of the present invention will become readily understood. In the accompanying drawings, several embodiments of the present invention are shown in an exemplary and non-restrictive manner, and the same or corresponding reference numerals represent the same or corresponding parts.

[0023] Figure 1 It is a method flow chart of a method for tracing the source of comprehensive sales information of agricultural products in an embodiment of the present invention. DETAILED DESCRIPTION

[0024] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0025] It should be understood that when the terms "first", "second", etc. are used in the claims, descriptions, and drawings of the present invention, they are only used to distinguish different objects, rather than to describe a specific order. The terms "include" and "comprise" used in the description and claims of the present invention indicate the presence of the described features, wholes, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components, and / or their collections.

[0026] The embodiment of the present invention discloses a method for tracing the source of comprehensive sales information of agricultural products, referring to Figure 1 , comprising steps S1 to S6: S1: Use the source information of agricultural products as the data to be encrypted and generate a unique password for each box of agricultural products.

[0027] The source information of agricultural products is collected in each link from production, processing, transportation to sales. For example, in the production process of agricultural products, information such as the planting location, growers, fertilizer application, and pesticide use of agricultural products is collected; in the processing of agricultural products, information such as the processing plant, processing process, and quality inspection results of agricultural products are collected; in the transportation process of agricultural products, information such as the transportation method, transportation company, and temperature control of agricultural products are collected; in the sales process of agricultural products, information such as the sales channel, sales date, and batch number of agricultural products are collected.

[0028] Generate a unique identity code, such as a QR code or barcode, for each box of agricultural products, and print the identity code on the packaging box of the agricultural products. Generate a unique password for each box of agricultural products, print the password on the packaging box, and use coating technology to apply an anti-counterfeiting scratch film on the password surface to hide the password. In each link of the production, processing, transportation and sales of agricultural products, relevant staff will scan the identity code of the agricultural products, upload the collected source information of the agricultural products to the agricultural product traceability platform, and associate the source information of the agricultural products with the identity code of the agricultural products on the agricultural product traceability platform.

[0029] After consumers purchase agricultural products, they use the traceability information query terminal to scan the identity code on the packaging box and send an agricultural product information traceability request to the agricultural product traceability platform. The agricultural product traceability platform queries the source information of the agricultural product based on the identity code in the agricultural product information traceability request, and returns the encrypted result of the source information and the query number of the source information of the agricultural product to the consumer's traceability information query terminal. The consumer scratches the anti-counterfeiting scratch film on the packaging box, enters the password in the traceability information query terminal, decrypts the encrypted result of the source information, and obtains the source information of the agricultural product. The traceability information query terminal can be the consumer's mobile phone, tablet computer, etc.

[0030] It should be noted that the agricultural product traceability platform returns the encrypted result of the source information to the consumer's traceability information query terminal in order to prevent the source information of the agricultural products from being stolen by attackers to forge the source information of counterfeit and substandard agricultural products. Therefore, the present invention uses the source information of the agricultural products as the data to be encrypted.

[0031] Generate a unique password for each box of produce, the password comprising a first key , Second Key and the third key , in the first key, the second key, and the third key , , is the bifurcation parameter in the Logistic chaotic mapping algorithm, and its value range is ; , , is the initial value parameter in the Logistic chaotic mapping algorithm, and its value range is (0,1); , , It is the number of iterations parameter, and its value range is ,and , , is an integer.

[0032] The password for each box of agricultural products is synchronously recorded in the agricultural product traceability platform.

[0033] S2: construct a character sequence according to the first key in the password, wherein the elements in the character sequence are non-repeating.

[0034] Using the first key Select 16 English capital letters from the 26 English capital letters without replacement to form a character sequence, specifically: According to the first key, a length of The value range of each element in the chaotic sequence is (0,1). element values ​​to Multiply it by 26 and round the result up to get integers in the range [1,26], respectively. , , , …, express.

[0035] Construct an empty character sequence and select the first character from the 26 uppercase English letters without replacement. letters are added to the character sequence; among the remaining 25 English capital letters, the first letters are added to the end of the sequence, where is the remainder symbol; select the first The number of letters is added to the end of the sequence; and so on, the iteration stops when the number of characters in the character sequence reaches 16.

[0036] At this point, the character sequence is obtained.

[0037] It should be noted that this embodiment only uses 26 English capital letters as an example to illustrate the method of constructing a character sequence. It should be noted that in order to ensure successful encryption, the length of the character sequence needs to meet ,in The present invention does not limit the elements contained in the character sequence. The implementer can set the elements in the character sequence according to the actual implementation situation, such as randomly selecting 16 English lowercase letters from 26 English lowercase letters without replacement, 64 printable characters in Base64 encoding, all integers in the range of [0,255], etc.

[0038] S3: Convert the data to be encrypted into a digital sequence.

[0039] Use GB2312 encoding to encode the data to be encrypted into a binary sequence. bits are divided into a binary string, where is the length of the character sequence. If the length of the last binary string is less than bits, then add multiple 0s to the end of the last binary string to make it as long as bits, recording the number of supplementary 0s . Convert all binary strings to decimal numbers, and the value range of each decimal number is , add 1 to each decimal number obtained, and form a digital sequence with the result. The value range of each number in the digital sequence is .

[0040] It should be noted that the present invention only uses GB2312 encoding as an example for explanation, and implementers can select an encoding algorithm for the encrypted data according to actual implementation conditions, such as UTF-8 encoding, Huffman encoding, etc.

[0041] S4: Construct a movement sequence according to the second key in the cipher, and construct a symbol sequence according to the third key in the cipher.

[0042] Construct a move sequence containing indivual An integer in the range integers are randomly arranged, is the length of the digital sequence, is the length of the character sequence, It is a hyperparameter, and its empirical value is 5. The implementer can set the hyperparameter according to the actual implementation situation. However, in order to prevent the mobile sequence from being too short and affecting the subsequent encryption process, Must be greater than 3.

[0043] In one embodiment, the method for constructing the moving sequence is: according to the second key Use the Logistic chaotic mapping algorithm to generate a length of A chaotic sequence of is the length of the digital sequence. The value range of each element in the chaotic sequence is (0,1). element values ​​to and Multiply and round up the result to get indivual Integer in the range, this indivual The sequence of integers in the range is used as the moving sequence, where Is the length of the character sequence.

[0044] Construct a symbol sequence containing elements, the value of the element is 0 or 1, Indicates the length of the digital sequence. In the symbol sequence, 0 is used to represent positive and 1 is used to represent negative.

[0045] In one embodiment, the method for constructing the symbol sequence is: according to the third key Use the Logistic chaotic mapping algorithm to generate a length of A chaotic sequence of Indicates the length of the digital sequence. The value range of each element in the chaotic sequence is (0,1). element values ​​to Rounding to the nearest integer, we get integer, this The value of an integer is 0 or 1. The symbol sequence is a sequence of integers.

[0046] It should be noted that the present invention only uses the Logistic chaotic mapping algorithm as an example to illustrate the acquisition of character sequences, movement sequences and symbol sequences. Implementers may also use other chaotic mapping algorithms to obtain character sequences, movement sequences and symbol sequences. When other chaotic mapping algorithms are used, the first key, the second key and the third key need to be set according to the chaotic mapping algorithm used.

[0047] S5: The agricultural product traceability platform encrypts the digital sequence according to the character sequence, symbol sequence and movement sequence to obtain the encrypted result of the source information.

[0048] Encrypt each number in the digital sequence in turn according to the character sequence, symbol sequence, and shift sequence to obtain the ciphertext of each number, and use the sequence composed of the ciphertexts of all numbers in the digital sequence as the encryption result of the source information, including: For the number sequence Numbers , the first Elements as The sign of the number with a sign , in response to , index the current character sequence as The elements as The ciphertext ; In response to , index the current character sequence as The elements as The ciphertext ,in Indicates the first Numbers The ciphertext the updated index in the current character sequence, Is the length of the character sequence.

[0049] In the sequence of numbers obtained Numbers The ciphertext Afterwards, according to the moving sequence, Update index in character sequence ,Will Move to the character sequence at index 's position to update the character sequence.

[0050] For example, when the digital sequence is {2,6,12,7,9,4,3,3,10}, the character sequence is {C,O,E,M,Y,Z,U,B,A,P,R,F,I,Q,J,T}, and the symbol sequence is {0,1,1,0,1,0,0,1,1}, where 0 represents positive and 1 represents negative, the ciphertext of the first number 2 in the digital sequence is the character E with index 2 in the character sequence. If the update index of the ciphertext E of the first number 2 in the digital sequence is 4, and the character sequence is updated to {C,O,M,Y,E,Z,U,B,A,P,R,F,I,Q,J,T}, the ciphertext of the second number 6 in the digital sequence is the character J with index (4-6)%16=14 in the character sequence.

[0051] In one embodiment, the updating of the character sequence according to the moving sequence location, get Update index in character sequence ,include: Let the first element in the current move sequence be ,but The updated index in the character sequence is: , where % is the remainder symbol, is the length of the character sequence, express The index before the update in the character sequence. Get Update index in character sequence Afterwards, the first element in the moving sequence is removed from the moving sequence to achieve the update of the moving sequence.

[0052] For example, when the number sequence is {2,6,12,7,9,4,3,3,10}, the character sequence is {C,O,E,M,Y,Z,U,B,A,P,R,F,I,Q,J,T}, the symbol sequence is {0,1,1,0,1,0,0,1,1}, and the move sequence is {2,10,3,4,8,1,7,5,5,2,14,1,9,8,12,2,1,5,12,8,11,…}, the secret number of the first number 2 in the number sequence is The ciphertext is the character E with index 2 in the character sequence, and the update index of E is (2+2)%16=4. Then the character sequence is updated to {C,O,M,Y,E,Z,U,B,A,P,R,F,I,Q,J,T}, and the move sequence is updated to {10,3,4,8,1,7,5,5,2,14,1,9,8,12,2,1,5,12,8,11,…}; the ciphertext of the second number 6 in the digital sequence is the index (4-6)%16 in the new character sequence. =14, and the update index of J is (14+10)%16=8. Then the character sequence is updated to {C,O,M,Y,E,Z,U,B,J,A,P,R,F,I,Q,T}, and the move sequence is updated to {3,4,8,1,7,5,5,2,14,1,9,8,12,2,1,5,12,8,11,…}. The ciphertext of the third number 12 in the digital sequence is the character F with index (8-12)%16=12 in the new character sequence. , the update index of F is (12+3)%16=15, then the character sequence is updated to {C,O,M,Y,E,Z,U,B,J,A,P,R,I,Q,T,F}, and the move sequence is updated to {4,8,1,7,5,5,2,14,1,9,8,12,2,1,5,12,8,11,…}; similarly, the ciphertexts of the 4th to 9th numbers in the digital sequence {7,9,4,3,3,10} are U,O,Q,M,J,C respectively. Then the encryption result of the source information is {E,J,F,U,O,Q,M,J,C}. The 7th and 8th numbers in the digital sequence are the same, both are 3, but their encryption results are different, M and J respectively. The 2nd and 8th ciphertexts in the encryption result are the same, both are J, but their corresponding plaintexts are different, 6 and 3 respectively. Therefore, the encryption result in this embodiment is complex, the encryption result does not have the data regularity in the digital sequence, and the encryption effect is better.

[0053] In another embodiment, the updating of the character sequence according to the moving sequence location, get Update index in character sequence ,include: In response to ,Will As Update index in character sequence ,in is the first element in the current moving sequence, % is the remainder symbol, is the length of the character sequence, express The index before the update in the character sequence; In response to ,like No. Candidate Update Index The damage degree is less than the preset damage threshold, and the calculation No. Candidate Update Index ;like No. Candidate Update Index If the damage degree is not less than the preset damage threshold, Candidate Update Index As Update index in character sequence ,in is the number of moves in the current sequence. elements, express The index before the update in the character sequence. Start with 1 and increase the value until you get Update index in character sequence Stop iteration when .

[0054] Get Update index in character sequence After that, get the update index The corresponding element in the current moving sequence removes the element and all the elements before it from the moving sequence to update the moving sequence.

[0055] Wherein, the degree of damage satisfies the expression:

[0056] in, The first Numbers The ciphertext No. The degree of damage to the candidate update index; , is the ordinal number of the number in the digital sequence, , , is the length of the character sequence; for No. Candidate update index; for The index before the update in the character sequence; The first Numbers The ciphertext Update index in the character sequence; Is the length of the character sequence.

[0057] In the formula, express No. Candidate update index and The difference between the indices before and after the update in the character sequence reflects the Candidate update index pair The location is updated when The smaller, according to the Candidate update index pair The position of the character sequence before and after the update The position of changes little, at this time No. The candidate update index has less damage to the character sequence; The larger the Candidate update index pair The position of the character sequence before and after the update The position changes greatly. No. The candidate update index is more disruptive to the character sequence.

[0058] In the formula, express No. Candidate update index and The difference between the updated indexes, Used for Normalize, when the difference is larger, according to the Candidate update index pair The position is updated with a step size of The more dissimilar the update step is, the more chaotic and irregular the character sequence is during the two updates, which in turn increases the complexity of the subsequent encryption results. No. The greater the degree of damage to the candidate update index; since local rules are easier to detect than discrete rules, this embodiment will As The weight of The bigger the Update location and The closer the location update is, the more attention is paid to it. No. Candidate update index and The difference between the updated indexes, conversely, when The smaller the time, the Update location and The further back in time the location update is, the less attention is paid to it. No. Candidate update index and The difference between the updated indexes.

[0059] Therefore, when No. Candidate update index and The difference between the indices before and after the update in the character sequence The larger the No. The candidate update index is the same as the first Numbers The greater the difference between the update indexes of the ciphertexts of the previous numbers, the more chaotic and irregular the character sequence will be each time it is updated. No. The more disruptive the candidate update index is.

[0060] The damage threshold is set by the implementer according to the actual implementation situation. Since the range of the damage degree is [0,1], the damage threshold should also be in [0,1]. For example , Is the length of the character sequence.

[0061] For example, when the number sequence is {2,6,12,7,9,4,3,3,10}, the character sequence is {C,O,E,M,Y,Z,U,B,A,P,R,F,I,Q,J,T}, the symbol sequence is {0,1,1,0,1,0,0,1,1}, and the move sequence is {2,10,3,4,8,1,7,5,5,2,14,1,9,8,12,2,1,5,12,8,11,…}, the ciphertext of the first number 2 in the number sequence is the character E with index 2 in the character sequence. The new index is (2+2)%16=4, so the character sequence is updated to {C,O,M,Y,E,Z,U,B,A,P,R,F,I,Q,J,T}, and the move sequence is updated to {10,3,4,8,1,7,5,5,2,14,1,9,8,12,2,1,5,12,8,11,…}; the ciphertext of the second number 6 in the digital sequence is the character J with index (4-6)%16=14 in the new character sequence, and the first candidate update index of J is (14+10)%16=8, and the degree of damage is , so take J's first candidate update index 8 as J's update index, then update the character sequence to {C,O,M,Y,E,Z,U,B,J,A,P,R,F,I,Q,T}, and update the move sequence to {3,4,8,1,7,5,5,2,14,1,9,8,12,2,1,5,12,8,11,…}; the ciphertext of the third number 12 in the digital sequence is the character F with index (8-12)%16=12 in the new character sequence, and the first candidate update index of F is (12+3)%16=15, the degree of damage is Therefore, the first candidate update index of F, 15, is used as the update index of F, and the character sequence is updated to {C, O, M, Y, E, Z, U, B, J, A, P, R, I, Q, T, F}, and the move sequence is updated to {4, 8, 1, 7, 5, 5, 2, 14, 1, 9, 8, 12, 2, 1, 5, 12, 8, 11, ...}; similarly, the ciphertexts of the 4th to 9th numbers in the digital sequence {7, 9, 4, 3, 3, 10} are U, O, Q, J, U, F respectively. The encrypted result of the source information is {E, J, F, U, O, Q, J, U, F}. The 7th and 8th digits in the digital sequence are the same, both are 3, but their encryption results are different, J and U respectively; the 2nd ciphertext in the encryption result is the same as the 7th ciphertext, both are J, but their corresponding plaintexts are different, 6 and 3 respectively; the 3rd ciphertext in the encryption result is the same as the 9th ciphertext, both are F, but their corresponding plaintexts are different, 12 and 10 respectively; the 4th ciphertext in the encryption result is the same as the 8th ciphertext, both are U, but their corresponding plaintexts are different, 7 and 3 respectively. Therefore, the encryption result in this embodiment is more complicated, the data regularity in the digital sequence is destroyed, and the encryption effect is better.

[0062] At this point, the encryption of source information is achieved.

[0063] S6: The agricultural product traceability platform returns the encrypted result of the source information to the consumer's traceability information query terminal, so that the traceability information query terminal decrypts the encrypted result of the source information to obtain the source information of the agricultural product.

[0064] Specifically, the consumer's traceability information query terminal uses the methods in steps S2 and S4 to obtain the character sequence, the movement sequence, and the symbol sequence.

[0065] Decrypt each ciphertext in the encryption result of the source information in turn according to the character sequence, the movement sequence, and the symbol sequence to obtain the decryption result of each ciphertext, including: For the encrypted result Ciphertext , get the ciphertext Index in the current character sequence , in response to , if the first When the sign is positive, As ciphertext The decryption result of When the sign is negative, As ciphertext The decryption result of In response to , get the ciphertext Index in the current character sequence With Ciphertext Index in the current character sequence The difference between ,when The symbol and the symbol sequence If the symbols are the same, As the Ciphertext The decryption result of The symbol and the symbol sequence If the symbols are different, The sign is positive, and the first If the sign is negative, As the Ciphertext The decryption result of The sign is negative, and the first If the sign is positive, As the Ciphertext The decryption result.

[0066] In getting the Ciphertext After the decryption result of Update index in character sequence ,Will Move to the character sequence at index 's position to update the character sequence.

[0067] in, Update index in character sequence The method for obtaining the updated index is the same as that in step S5 and will not be repeated here.

[0068] A sequence consisting of decryption results of each ciphertext in the encryption result of the source information is used as a digital sequence.

[0069] For example, when the encryption result is {E, J, F, U, O, Q, M, J, C}, the character sequence is {C, O, E, M, Y, Z, U, B, A, P, R, F, I, Q, J, T}, the symbol sequence is {0, 1, 1, 0, 1, 0, 0, 1, 1}, and the move sequence is {2, 10, 3, 4, 8, 1, 7, 5, 5, 2, 14, 1, 9, 8, 12, 2, 1, 5, 12, 8, 11, ...}, when the method in the first embodiment in step S5 is used to obtain the update index, the index of the first ciphertext E in the ciphertext sequence in the current character sequence is 2, and the first symbol in the symbol sequence is 0, indicating positive, then 2 is used as the index of the ciphertext E. Decryption result, the update index of E is (2+2)%16=4, then the character sequence is updated to {C,O,M,Y,E,Z,U,B,A,P,R,F,I,Q,J,T}, and the move sequence is updated to {10,3,4,8,1,7,5,5,2,14,1,9,8,12,2,1,5,12,8,11,…}; the index of the second ciphertext J in the ciphertext sequence in the current character sequence is 14, and the difference between the index 14 of the ciphertext J in the current character sequence and the index 4 of the first ciphertext E in the current character sequence is 14-4=10. The second symbol in the symbol sequence is 1, which means negative, and the difference between the sign and the sign is 10. The second symbol in the sequence is different, and the symbol of 10 is positive, and the second symbol in the symbol sequence is negative, then 16-14+4=6 is used as the decryption result of the second ciphertext J, and the update index of J is (14+10)%16=8, then the character sequence is updated to {C,O,M,Y,E,Z,U,B,J,A,P,R,F,I,Q,T}, and the move sequence is updated to {3,4,8,1,7,5,5,2,14,1,9,8,12,2,1,5,12,8,11,…}; the index of the third ciphertext F in the ciphertext sequence in the current character sequence is 12, and the index of ciphertext F in the current character sequence is 12, which is the same as the second ciphertext J. The difference between index 8 in the current character sequence is 12-8=4, the third symbol in the symbol sequence is 1, indicating negative, the sign of the difference 4 is different from the third symbol in the symbol sequence, and the sign of 4 is positive, and the third symbol in the symbol sequence is negative, then 16-12+8=12 is used as the decryption result of the third ciphertext F, and the update index of F is (12+3)%16=15, then the character sequence is updated to {C,O,M,Y,E,Z,U,B,J,A,P,R,I,Q,T,F}, and the move sequence is updated to {4,8,1,7,5,5,2,14,1,9,8,12,2,1,5,12,8,11,…};The index of the fourth ciphertext U in the ciphertext sequence in the current character sequence is 6. The difference between the index 6 of the ciphertext U in the current character sequence and the index 15 of the third ciphertext F in the current character sequence is 6-15=-9. The fourth symbol in the symbol sequence is 0, indicating positive. The sign of the difference -9 is different from the fourth symbol in the symbol sequence, and the sign of -9 is negative. The fourth symbol in the symbol sequence is positive, so 16+6-15=7 is used as the fourth ciphertext U. The decryption result of U is (6+4)%16=10, then the character sequence is updated to {C,O,M,Y,E,Z,B,J,A,P,U,R,I,Q,T,F}, and the move sequence is updated to {8,1,7,5,5,2,14,1,9,8,12,2,1,5,12,8,11,…}; Similarly, the decryption results of the 5th to 9th ciphertext O, Q, M, J, C in the ciphertext sequence are 9, 4, 3, 3, 10 respectively. Then the digital sequence is {2,6,12,7,9,4,3,3,10}. ;

[0070] Subtract 1 from each number in the digital sequence and convert it into binary data. Concatenate all the binary data into a binary sequence and replace the last digit of the binary sequence with the last digit of the binary sequence. bits are removed, and the binary sequence is decoded using the encoding method in step S2 to obtain the source information, where is the number of supplemented 0s recorded in step S3.

[0071] The traceability information query terminal displays the source information to consumers. If the source information is garbled, the encrypted result of the source information has been tampered with in the process of the agricultural product traceability platform returning the encrypted result of the source information to the consumer's traceability information query terminal. At this time, the source information is no longer credible, and the agricultural product may be a counterfeit or inferior product. If the agricultural product traceability platform returns the query number of the source information of the agricultural product to the consumer's traceability information query terminal for more than one time, the agricultural product may be a counterfeit or inferior product.

[0072] At this point, the traceability of comprehensive sales information of agricultural products has been realized.

[0073] An embodiment of the present invention also discloses a system for tracing the source of comprehensive agricultural product sales information, including a processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, a method for tracing the source of comprehensive agricultural product sales information according to the present invention is implemented.

[0074] The above system also includes other components well known to those skilled in the art, such as a communication bus and a communication interface, and their configuration and functions are known in the art, so they will not be described in detail here.

[0075] Although this specification has shown and described a number of embodiments of the present invention, it will be apparent to those skilled in the art that such embodiments are provided by way of example only. Those skilled in the art will conceive of many modifications, changes and alternatives without departing from the ideas and spirit of the present invention. It should be understood that in the practice of the present invention, various alternatives to the embodiments of the present invention described herein may be employed.

[0076] The above are all preferred embodiments of the present invention, and are not intended to limit the protection scope of the present invention. Therefore, any equivalent changes made based on the structure, shape, and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A method for tracing the source of comprehensive sales information of agricultural products, characterized in that: include: In response to the agricultural product traceability platform receiving the agricultural product information traceability request, querying the source information of the agricultural product according to the identity code in the agricultural product information traceability request, encrypting the source information, and returning the encrypted result to the consumer so that the consumer can view the source information; The encryption includes: constructing a character sequence, in which elements are not repeated; converting the source information into a digital sequence; constructing a moving sequence and a symbol sequence, in which each element is an integer whose size does not exceed the length of the character sequence, and the element in the symbol sequence is 0 or 1, which is used to represent positive or negative; encrypting each number in the digital sequence in turn to obtain the ciphertext of each number, which constitutes the encryption result of the source information, including: for the first number in the digital sequence, Numbers , the first Elements as The sign of the number with a sign , in response to , index the current character sequence as The elements as The ciphertext ; In response to , index the current character sequence as The elements as The ciphertext ,in Indicates the first Numbers The ciphertext the updated index in the current character sequence, is the length of the character sequence, % is the remainder symbol; get according to the moving sequence Update index in character sequence ,Will Move to the character sequence at index 's position to update the character sequence.

2. A method for tracing the source of comprehensive agricultural product sales information according to claim 1, characterized in that: The constructing of the character sequence comprises: Preset length of character sequence ,in Need to meet ; Select from multiple different characters without replacement characters to form a character sequence.

3. The method for tracing the source of comprehensive agricultural product sales information according to claim 1, characterized in that: The converting of the source information into a digital sequence comprises: Encode the data to be encrypted into a binary sequence. bits are divided into a binary string; all binary strings are converted into decimal numbers, each decimal number obtained is added by 1, and the results form a digital sequence.

4. The method for tracing the source of comprehensive agricultural product sales information according to claim 1, characterized in that: The method of obtaining the Update index in character sequence ,include: Let the first element in the current move sequence be ,but The updated index in the character sequence is: , express The index before the update in the character sequence; Get Update index in character sequence Afterwards, the first element in the moving sequence is removed from the moving sequence to achieve the update of the moving sequence.

5. The method for tracing the source of comprehensive agricultural product sales information according to claim 1, characterized in that: The method of obtaining the Update index in character sequence ,include: In response to ,Will As Update index in character sequence ,in is the first element in the current move sequence, express the index before the update in the character sequence; in response to ,like No. Candidate Update Index The damage degree is less than the preset damage threshold, and the No. Candidate Update Index ;like No. Candidate Update Index If the damage degree is not less than the preset damage threshold, Candidate Update Index As Update index in character sequence ,in is the number of moves in the current sequence. elements; Start with 1 and increase the value until you get Update index in character sequence Stop iteration when .

6. A method for tracing the source of comprehensive agricultural product sales information according to claim 5, characterized in that: The degree of damage satisfies the expression: ; in, The first Numbers The ciphertext No. The degree of damage to the candidate update index; is the ordinal number of the number in the digital sequence, ; The first Numbers The ciphertext The updated index in the character sequence.

7. The method for tracing the source of comprehensive agricultural product sales information according to claim 1, characterized in that: The construction of the moving sequence comprises: Use the Logistic chaotic mapping algorithm to generate a length of A chaotic sequence of is the length of the digital sequence; element values ​​to and Multiply and round up the result to get indivual Integer in the range, this indivual The sequence of integers in the range is used as the moving sequence, where is a hyperparameter, Parameter for the number of iterations in the second key.

8. The method for tracing the source of comprehensive agricultural product sales information according to claim 1, characterized in that: The method for constructing the symbol sequence is: Use the Logistic chaotic mapping algorithm to generate a length of A chaotic sequence of Indicates the length of the digital sequence; element values ​​to Rounding to the nearest integer, we get integer, this The value of an integer is 0 or 1. The symbol sequence is a sequence of integers, where Parameter for the number of iterations in the third key.

9. A comprehensive agricultural product sales information traceability system, characterized in that: include: A processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, a method for tracing the source of comprehensive sales information of agricultural products according to any one of claims 1-8 is implemented.

Citation Information

Patent Citations

  • Pomelo fruit agricultural product processing safety traceability method and system

    CN114757685A

  • Urban multi-source data whole-process comprehensive management system

    CN114282903A

  • Intelligent storage method and system for test data of intelligent driving system

    CN116545771A

  • Medical instrument product information tracing method and system

    CN118487874A

  • Wearable device having corrective lens with diffractive surface

    CN118584656A