A method and system for tracing comprehensive agricultural product sales information

The sequence generated by the symmetric encryption method and the Logistic chaotic mapping algorithm encrypts the source information of agricultural products, solving the problem of slow asymmetric encryption algorithm and achieving fast and secure traceability of agricultural products.

CN119398802BActive Publication Date: 2025-08-26YUNNEX TECH +1
View PDF 3 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

In the prior art, asymmetric encryption algorithms are slow in the traceability process of agricultural product comprehensive sales information, which affects the traceability speed, and key management is complex.

Method used

The symmetric encryption method is used to generate character sequences, moving sequences and symbol sequences using the Logistic chaotic mapping algorithm to encrypt agricultural product source information, and improve encryption speed and complexity by constructing character sequences and updating indexes.

Benefits of technology

The encryption speed is fast, the key length is short, and the key management is simple, which improves the traceability and credibility of comprehensive sales data of agricultural products and can resist statistical analysis attacks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119398802B_ABST
    Figure CN119398802B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of information traceability technology, and more particularly to a method and system for tracing the source of comprehensive agricultural product sales information. The method comprises: an agricultural product traceability platform encrypting the source information of agricultural products and returning the encrypted result to consumers. The encryption process comprises: converting the source information into a digital sequence; constructing a character sequence, a shift sequence, and a symbol sequence; and encrypting the digital sequence, including: converting the #imgabs1#th number #imgabs2# in the digital sequence into a signed number #imgabs3# based on the #imgabs0#th element in the symbol sequence; when #imgabs4#, using the element indexed #imgabs5# in the character sequence as the ciphertext #imgabs7# of #imgabs6#, where #imgabs8# is the length of the character sequence; obtaining an updated index #imgabs10# of #imgabs9# based on the shift sequence, and updating the character sequence based on #imgabs11#. The encryption result of the present invention is complex, exhibits an avalanche effect, and is resistant to statistical analysis attacks and brute force attacks, thereby improving 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, preventing consumers from effectively verifying the product's origin, production process, and quality. This not only impacts their purchasing decisions but also increases the risk of counterfeit and substandard products. Therefore, a highly operational agricultural product sales information traceability method is urgently needed to protect consumer rights and food safety.

[0003] Chinese patent publication number CN114757685A discloses a method and system for secure traceability of processed pomelo agricultural products. The system includes: an encrypted signature device uses a private key to sign traceability information, encrypts the signature and information using a daily session key, and then returns the encrypted signature and information to the enterprise device and reports them to a traceability center. The traceability center decrypts the encrypted signature and information using the daily session key and verifies the signature using an elliptic curve. Consumers scan the traceability QR code on their mobile devices to obtain the product's traceability information. A user app uses the traceability center's public key to perform encrypted queries, verifying the authenticity of the data source.

[0004] While the above methods can achieve agricultural product information traceability, they use asymmetric encryption algorithms to encrypt this information. Asymmetric encryption algorithms are slow to encrypt and decrypt, have large key lengths, and complex key management, making them suitable only for encrypting small amounts of data. Comprehensive agricultural product sales information, encompassing information from production, processing, transportation, and sales, is large in volume. Using asymmetric encryption algorithms for encryption and decryption is slow, hindering the speed of tracing this information. Summary of the Invention

[0005] In order to solve the problem that the encryption and decryption speed of agricultural product comprehensive sales information using asymmetric encryption algorithms is slow, which affects the traceability speed of agricultural product comprehensive sales information, the present invention provides a method and system for tracing agricultural product comprehensive 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:

[0007] 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, 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, 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 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 Ciphertext ; In response to , index the current character sequence as The elements as Ciphertext ,in Indicates the first Numbers 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 position to update the character sequence.

[0008] 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 character with the same index in the character sequence and the 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 result 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 encrypted result of the source information, and improves the credibility of the traceability of agricultural product information; Obtaining the ciphertext of the next number makes the ciphertext of the next number not only related to the next number, but also related 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 having a better encryption effect on the source information and 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 increases the complexity of the ciphertext, and has a better encryption effect on the source information of agricultural products.

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

[0010] Preferably, the converting of 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.

[0011] 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, increases the encryption speed, and can improve the traceability speed of comprehensive agricultural product sales data.

[0012] Preferably, the step of obtaining the 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 update the moving sequence.

[0013] 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.

[0014] Preferably, the step of obtaining the 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 degree of damage is not less than the preset damage threshold, Candidate Update Index As Update index in character sequence ,in 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 .

[0015] 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.

[0016] Preferably, the degree of damage satisfies the expression: ;in, The first Numbers 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 Ciphertext The updated index in the character sequence.

[0017] 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 being updated 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 the ciphertexts do not have similar update rules, 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.

[0018] Preferably, the construction of the moving sequence includes: using the Logistic Chaotic Mapping Algorithm to generate a length of The 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.

[0019] Preferably, the method for constructing the symbol sequence is: using the Logistic Chaotic Mapping algorithm to generate a length of The chaotic sequence of Indicates the length of the digital sequence; element values ​​to Rounding off 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.

[0020] In a second aspect, the present invention provides a comprehensive agricultural product sales information traceability system, 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 comprehensive agricultural product sales information traceability method is implemented.

[0021] 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, thereby making a terminal device based on the memory and the processor for easy use.

[0022] The present invention has the following technical effects:

[0023] (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;

[0024] (2) The key space in the present invention is large and can resist brute force attacks;

[0025] (3) The ciphertext in the present invention is completely different from the plaintext, which increases the complexity of the ciphertext, makes it more difficult for attackers to crack the encrypted result of the source information, and improves the credibility of agricultural product information traceability;

[0026] (4) The encryption result of the present invention has an avalanche effect, which destroys the statistical law between plaintext and ciphertext and can resist statistical analysis attacks;

[0027] (5) The present invention continuously updates the character sequence during the encryption process, further improving the complexity of the ciphertext and achieving better encryption effect on the source information of agricultural products. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] By reading the detailed description below with reference to the accompanying drawings, the above and other objects, 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-limiting manner, and the same or corresponding numbers represent the same or corresponding parts.

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

[0030] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work shall fall within the scope of protection of the present invention.

[0031] It should be understood that when the terms "first," "second," and the like are used in the claims, description, and drawings of the present invention, they are merely used to distinguish between different objects, rather than to describe a specific order. The terms "comprise" and "comprising" used in the description and claims of the present invention indicate the presence of the described features, integers, steps, operations, elements, and / or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or combinations thereof.

[0032] The embodiment of the present invention discloses a method for tracing the source of comprehensive sales information of agricultural products, referring to Figure 1 , including steps S1 to S6:

[0033] 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.

[0034] Collect information on the origin of agricultural products at every stage of their production, processing, transportation, and sales. For example, during the production process, collect information on the location of the agricultural products, the growers, fertilization, and pesticide use; during the processing of agricultural products, collect information on the processing plant, processing procedures, and quality inspection results; during the transportation of agricultural products, collect information on the transportation method, transportation company, and temperature control; and during the sales process, collect information on the sales channel, sales date, and batch number.

[0035] A unique identification code, such as a QR code or barcode, is generated for each box of agricultural products and printed on the packaging. A unique password is also generated for each box and printed on the packaging. A scratch-off film is applied to the password using a coating to conceal the password. Throughout the production, processing, transportation, and sales process, relevant staff scan the agricultural product's identification code and upload the collected source information to the agricultural product traceability platform, where it is linked to the agricultural product's identification code.

[0036] After purchasing agricultural products, consumers use a traceability information query terminal to scan the identification code on the packaging box and send a traceability request to the agricultural product traceability platform. The platform then queries the agricultural product's source information based on the identification code in the request. It then returns the encrypted source information and the number of source information queries to the consumer's traceability information query terminal. The consumer then scratches off the anti-counterfeiting scratch-off film on the packaging box and enters a password into the traceability information query terminal to decrypt the encrypted source information and obtain the agricultural product's source information. The traceability information query terminal can be a consumer's mobile phone, tablet, or other device.

[0037] 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 to prevent the source information of agricultural products from being stolen by attackers and forged to produce counterfeit and inferior agricultural products. Therefore, the present invention uses the source information of agricultural products as the data to be encrypted.

[0038] Generate a unique password for each box of agricultural products, the password including 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.

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

[0040] S2: Construct a character sequence according to the first key in the password, wherein the elements in the character sequence are non-repeated.

[0041] Using the first key Select 16 uppercase English letters from the 26 uppercase English letters without replacement to form a character sequence. Specifically:

[0042] According to the first key, a length of The value range of each element in the chaotic sequence is (0,1). element values ​​to Multiplying by 26 and rounding up the result, we get integers in the range [1,26], respectively. 、 、 、…、 express.

[0043] Construct an empty character sequence and select the first character from the 26 English capital 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 letters are added to the end of the sequence; and so on, the iteration is stopped when the number of characters in the character sequence reaches 16.

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

[0045] 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 smooth encryption, the length of the character sequence must 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 16 English lowercase letters randomly selected without replacement from the 26 English lowercase letters, 64 printable characters in Base64 encoding, all integers in the range of [0,255], etc.

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

[0047] Use GB2312 encoding to encode the data to be encrypted into a binary sequence, and encode each 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 its length reach 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 .

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

[0049] 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.

[0050] Construct a move sequence containing indivual Integer in the range, and this integers are randomly arranged, where is the length of the digital sequence, is the length of the character sequence, It is a hyperparameter, and the 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.

[0051] 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 The 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.

[0052] 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.

[0053] 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 The 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 off 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.

[0054] 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 can 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 adopted.

[0055] 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.

[0056] Encrypt each number in the digital sequence in sequence 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:

[0057] 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 Ciphertext ; In response to , index the current character sequence as The elements as Ciphertext ,in Indicates the first Numbers Ciphertext the updated index in the current character sequence, is the length of the character sequence.

[0058] In the sequence of numbers Numbers Ciphertext Afterwards, according to the moving sequence, Update index in character sequence ,Will Move to the character sequence at index position to update the character sequence.

[0059] 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}, 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 number 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 number 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 number sequence is the character J with index (4-6)%16=14 in the character sequence.

[0060] In one embodiment, the character sequence is updated according to the movement sequence. Get the location Update index in character sequence ,include:

[0061] 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 update the moving sequence.

[0062] 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 movement sequence is {2,10,3,4,8,1,7,5,5,2,14,1,9,8,12,2,1,5,12,8,11,…}, the password for the first number 2 in the number sequence is The ciphertext is the character E with index 2 in the character sequence. 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, so 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 digits in the digital sequence {7,9,4,3,3,10} are U,O,Q,M,J,C, respectively. The encrypted result of the source information is {E,J,F,U,O,Q,M,J,C}. The 7th and 8th digits in the digital sequence are the same, both 3, but their encrypted results are different, M and J, respectively. The 2nd and 8th ciphertexts in the encrypted result are the same, both J, but their corresponding plaintexts are different, 6 and 3, respectively. Therefore, the encryption result in this embodiment is complex and does not have the data regularity in the digital sequence, and the encryption effect is better.

[0063] In another embodiment, the updating of the character sequence according to the moving sequence Get the location Update index in character sequence ,include:

[0064] 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;

[0065] In response to ,like No. Candidate Update Index The damage degree is less than the preset damage threshold, calculate No. Candidate Update Index ;like No. Candidate Update Index If the degree of damage is not less than the preset damage threshold, Candidate Update Index As Update index in character sequence ,in 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 .

[0066] Get Update index in character sequence Afterwards, get the updated index For the element corresponding to the current moving sequence, remove the element and all the elements before it from the moving sequence to update the moving sequence.

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

[0068]

[0069] in, The first Numbers 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 Ciphertext Update index in character sequence; is the length of the character sequence.

[0070] Where, express No. Candidate update index and The difference between the indices before and after the update in the character sequence reflects the difference between the indices before and after the update in the character sequence. Candidate update index pairs The location is updated when the validity The smaller, according to Candidate update index pairs The position of the character sequence before and after the update The position of does not change much. No. The less damage the candidate update index does to the character sequence; The larger the Candidate update index pairs The position of the character sequence before and after the update The position changes greatly. No. The more disruptive the candidate update index is to the character sequence.

[0071] Where, express No. Candidate update index and The difference between the updated indexes, Used for Normalize, when the difference is greater, according to the Candidate update index pairs The position is updated with a step size of The more dissimilar the update step is, the more chaotic and irregular the character sequence will be when updating the two times, which will increase 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 No. Candidate update index and The difference between the updated indexes, on the contrary, when The smaller the time, the better. 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.

[0072] Therefore, when No. Candidate update index and The difference between the indices before and after the update in the character sequence The bigger, and 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 destructive the candidate update index is.

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

[0074] 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 shift 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. 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, we use F's first candidate update index 15 as F's update index. 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 number 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 3, but their encrypted results are different, J and U respectively. The 2nd and 7th ciphertexts in the encrypted result are the same, both J, but their corresponding plaintexts are different, 6 and 3 respectively. The 3rd and 9th ciphertexts in the encrypted result are the same, both F, but their corresponding plaintexts are different, 12 and 10 respectively. The 4th and 8th ciphertexts in the encrypted result are the same, both U, but their corresponding plaintexts are different, 7 and 3 respectively. Therefore, the encryption result in this embodiment is more complex, the data regularity in the digital sequence is destroyed, and the encryption effect is better.

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

[0076] 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 and obtains the source information of the agricultural product.

[0077] 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.

[0078] Decrypt each ciphertext in the encrypted result of the source information in sequence according to the character sequence, the shift sequence, and the symbol sequence to obtain the decryption result of each ciphertext, including:

[0079] 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 the symbol sequence is When the sign is negative, As ciphertext The decryption result of

[0080] In response to , get the ciphertext Index in the current character sequence With the ciphertext Index in the current character sequence The difference between ,when The symbol and the first If the symbols are the same, As the first ciphertext The decryption result of The symbol and the first If the symbols are different, The sign is positive, and the first If the sign is negative, As the first ciphertext The decryption result of The sign is negative, the first If the sign is positive, As the first ciphertext The decryption result.

[0081] In getting the ciphertext After decrypting the result, get the Update index in character sequence ,Will Move to the character sequence at index position to update the character sequence.

[0082] 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.

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

[0084] 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 shift 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 a positive value, 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 symbol 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 updated 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 shift 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 the ciphertext F in the current character sequence is 12, which is the same as the index of 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 a 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 updated 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 is 6 in the current character sequence. 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. Therefore, 16+6-15=7 is used as the fourth ciphertext U. The decryption result of U is (6+4)%16=10, so 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 ciphertexts O, Q, M, J, and C in the ciphertext sequence are 9, 4, 3, 3, and 10 respectively. The number sequence is then {2,6,12,7,9,4,3,3,10}.

[0085] After subtracting 1 from each number in the digital sequence, convert it into binary data, concatenate all the binary data obtained into a binary sequence, and replace the suffix of the binary sequence with the suffix 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 The number of supplemented 0s recorded in step S3.

[0086] The traceability information query terminal displays the source information to the consumer. If the source information is garbled, it means that the encrypted result of the source information was tampered with during the process of returning it to the consumer's traceability information query terminal. At this point, the source information is no longer trustworthy, and the agricultural product may be counterfeit or inferior. If the agricultural product traceability platform returns the source information query for the agricultural product to the consumer's traceability information query terminal more than once, the agricultural product may be counterfeit or inferior.

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

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

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

[0090] While several embodiments of the present invention have been shown and described herein, it will be apparent to those skilled in the art that such embodiments are provided by way of example only. Numerous modifications, variations, and alternatives will occur to those skilled in the art without departing from the concept and spirit of the present invention. It should be understood that various alternatives to the embodiments of the present invention described herein may be employed in practicing the present invention.

[0091] The above are all preferred embodiments of the present invention, and are not intended to limit the scope of protection 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 scope of protection 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 an 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 each element in the symbol sequence is 0 or 1, 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 Ciphertext ; In response to , index the current character sequence as The elements as Ciphertext ,in Indicates the first Numbers 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 The position of the character sequence is updated; the character sequence is obtained according to the mobile 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 degree of damage is not less than the preset damage threshold, Candidate Update Index As Update index in character sequence ,in 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 The degree of damage satisfies the expression: ; in, The first Numbers 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 Ciphertext The updated index in 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 includes: Preset length of character sequence ,in Need to meet ; Select from multiple different characters without replacement characters, forming 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, and 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 update the moving sequence.

5. The method for tracing the source of comprehensive agricultural product sales information according to claim 1, characterized in that: The constructing of the movement sequence comprises: Use the Logistic Chaotic Mapping algorithm to generate a length of The 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.

6. 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 The chaotic sequence of Indicates the length of the digital sequence; element values ​​to Rounding off 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.

7. A comprehensive agricultural product sales information traceability system, characterized by: 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 agricultural product sales information according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Pomelo fruit agricultural product processing safety traceability method and system

    CN114757685A

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

    CN116545771A

  • Medical instrument product information tracing method and system

    CN118487874A