CN117291750B - Block chain-based veterinary waste traceability management method and system - Google Patents

Block chain-based veterinary waste traceability management method and system Download PDF

Info

Publication number
CN117291750B
CN117291750B CN202311586555.4A CN202311586555A CN117291750B CN 117291750 B CN117291750 B CN 117291750B CN 202311586555 A CN202311586555 A CN 202311586555A CN 117291750 B CN117291750 B CN 117291750B
Authority
CN
China
Prior art keywords
combination
ciphertext
segments
hash
veterinary
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202311586555.4A
Other languages
Chinese (zh)
Other versions
CN117291750A (en
Inventor
赵蕾
王利军
张金庆
陈科睿
岳芽
陈坤
冯东亚
司西波
刘敏
王彦丽
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Pingli County Nuwa Mingding Agricultural Technology Co ltd
Original Assignee
Pingli County Nuwa Mingding Agricultural Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Pingli County Nuwa Mingding Agricultural Technology Co ltd filed Critical Pingli County Nuwa Mingding Agricultural Technology Co ltd
Priority to CN202311586555.4A priority Critical patent/CN117291750B/en
Publication of CN117291750A publication Critical patent/CN117291750A/en
Application granted granted Critical
Publication of CN117291750B publication Critical patent/CN117291750B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q50/00Information and communication technology [ICT] specially adapted for implementation of business processes of specific business sectors, e.g. utilities or tourism
    • G06Q50/02Agriculture; Fishing; Forestry; Mining
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/62Protecting access to data via a platform, e.g. using keys or access control rules
    • G06F21/6218Protecting access to data via a platform, e.g. using keys or access control rules to a system of files or objects, e.g. local or distributed file system or database
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/64Protecting data integrity, e.g. using checksums, certificates or signatures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q50/00Information and communication technology [ICT] specially adapted for implementation of business processes of specific business sectors, e.g. utilities or tourism
    • G06Q50/10Services
    • G06Q50/26Government or public services
    • G06Q50/265Personal security, identity or safety

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer Security & Cryptography (AREA)
  • General Physics & Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • Health & Medical Sciences (AREA)
  • Tourism & Hospitality (AREA)
  • Bioethics (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Computer Hardware Design (AREA)
  • Human Resources & Organizations (AREA)
  • Marketing (AREA)
  • Primary Health Care (AREA)
  • Strategic Management (AREA)
  • General Business, Economics & Management (AREA)
  • Economics (AREA)
  • Marine Sciences & Fisheries (AREA)
  • Development Economics (AREA)
  • Educational Administration (AREA)
  • Agronomy & Crop Science (AREA)
  • Animal Husbandry (AREA)
  • Mining & Mineral Resources (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Databases & Information Systems (AREA)
  • Storage Device Security (AREA)

Abstract

The invention relates to the technical field of data processing for traceability management, in particular to a method and a system for traceability management of veterinary waste based on a blockchain, which comprise the following steps: the method comprises the steps of marking sources of veterinary wastes, encrypting the source marks to obtain ciphertext, dividing the ciphertext into a plurality of segments, combining the segments to obtain all combination modes, obtaining the optimal degree of each combination mode according to the segments contained in each combination mode, further screening an optimal combination mode, calculating the segments contained in each combination in the optimal combination mode, obtaining the secret value of each combination, obtaining the hash value of the secret value, serving as verification hash of each combination, performing tamper-proof verification and error correction on the ciphertext according to the ciphertext and the verification hash of each combination, and performing veterinary waste tracing according to the ciphertext after error correction. The invention can realize tamper-proof verification and error correction in the process of tracing the veterinary waste, so that the veterinary waste tracing is more accurate.

Description

Block chain-based veterinary waste traceability management method and system
Technical Field
The invention relates to the technical field of data processing for traceability management, in particular to a method and a system for traceability management of veterinary waste based on a blockchain.
Background
In order to avoid harm to the environment and personal safety caused by random discarding of the veterinary waste, the veterinary waste needs to be subjected to harmless treatment. To prevent the waste from flowing out and being discarded, the waste is required to be managed by tracing the source of the waste.
In the process of traceability management of veterinary waste, in order to prevent artificial falsification of sources of veterinary waste, falsification prevention verification of veterinary waste is required. At present, tamper-proof verification is usually carried out through a hash value, but both tamper and error codes can cause the change of the hash value, and tamper and error codes cannot be distinguished by utilizing the hash value, so that the trace of the waste for the veterinary use is unreliable.
Disclosure of Invention
In order to solve the problems, the invention discloses a block chain-based veterinary waste traceability management method and a block chain-based veterinary waste traceability management system.
The invention discloses a block chain-based veterinary waste traceability management method, which adopts the following technical scheme:
one embodiment of the invention provides a blockchain-based veterinary waste traceability management method comprising the steps of:
the method comprises the steps of marking sources of veterinary wastes, wherein the sources comprise types, amounts, packing time, packing personnel and veterinary hospitals to which the veterinary wastes belong;
encrypting the source mark to obtain a ciphertext; dividing the ciphertext into a plurality of segments; combining the segments to obtain all combination modes; acquiring the preference degree of each combination mode according to the segments contained in each combination mode; taking the combination mode with the greatest preference degree as an optimal combination mode;
calculating the segments contained in each combination in the optimal combination mode to acquire the secret value of each combination; obtaining a hash value of each combined secret value as a verification hash of each combination;
the block chain performs tamper-proof verification and error correction on the ciphertext according to the ciphertext and each combined verification hash; and tracing the veterinary waste according to the corrected ciphertext.
Preferably, the dividing the ciphertext into a plurality of segments comprises the following specific steps:
generating a chaotic sequence by using a chaotic mapping method; the number of preset segmentsAcquiring the length of ciphertext->By adding>The individual elements are multiplied by +.>Then, upward rounding is carried out, and the obtained results are respectively used as an initial index; the chaos sequence is->The individual elements are multiplied by +.>Then, the upper rounding is carried out, and the obtained results are respectively used as a segment length, whereinThe symbol is a value symbol which is taken upwards;
obtaining the index in the text asBit of->The bit is used for obtaining the secret>For the beginning, length->As a segment, wherein +.>Is->Start index->Is->The segment lengths.
Preferably, the steps of combining the segments to obtain all the combination modes include the following specific steps:
each segment and any two different segments are respectively formed into a combination, and the combination result is used as a combination mode; all combinations are obtained.
Preferably, the obtaining the preference degree of each combination mode according to the segments included in each combination mode includes the following specific steps:
wherein,is->Preference degree of the seed combination mode; />Is->The length of the individual segments; />The number of the segments; />Indicate->The individual segments are at->In the corresponding first combination of the combination patterns, the first +.>The number of bits that each segment overlaps with another segment in the combination in the ciphertext; />Indicate->The individual segments are at->In the corresponding second combination of the combination patterns, the first is->The number of bits that each segment overlaps with another segment in the combination in the ciphertext; />Indicate->The individual segments are at->In the two corresponding combinations of the combination modes, except for the first->The number of bits that overlap in the ciphertext for two segments outside of the segment.
Preferably, the computing the segments included in each combination in the optimal combination manner to obtain the secret value of each combination includes the following specific steps:
respectively converting binary data segments corresponding to two segments in each combination in the optimal combination mode into decimal numbers, and taking the decimal numbers as two representative values of each combination; and constructing a CP-ABE tree by using the two representative values of each combination as leaf nodes and using a ciphertext policy-attribute-based encryption algorithm, and acquiring the value of a root node according to the value of the leaf nodes to serve as the secret value of each combination.
Preferably, the blockchain performs tamper-proof verification and error correction on the ciphertext according to the ciphertext and each combined verification hash, and the method comprises the following specific steps:
the block chain acquires an optimal combination mode and a secret value of each combination in the optimal combination mode according to the ciphertext, and takes a hash value of the secret value of each combination as a comparison hash;
comparing the comparison hash and the verification hash for each combination, comprising: when the comparative hash and verification Ha Xidou of each combination are the same, there is no tampering and no error code; when the combined comparison hash and the verification hash are different, and the combined comparison hash exceeding the preset proportion threshold is the same as the verification hash, the ciphertext is considered not tampered, but the error code exists; when there is no combined comparative hash exceeding the preset proportion threshold and verification Ha Xixiang, the ciphertext is considered to be tampered;
when the ciphertext is not tampered, but error codes exist, error correction is performed on the ciphertext.
Preferably, the error correction of the ciphertext includes the following specific steps:
acquiring intersections between all combinations of which the comparison hash and the verification hash are different from each other, and taking the segments in the intersections as error code segments;
for each error code segment, sequentially modifying each bit in the error code segment, acquiring a comparison hash of a corresponding combination by using each modified error code segment, stopping modification when the comparison hash is verified Ha Xixiang, and taking the modification result of the error code segment at the moment as a correct segment;
and replacing the corresponding error code segment in the ciphertext by using all the correct segments to realize the error correction of the ciphertext.
Preferably, the step of tracing the veterinary waste according to the corrected ciphertext includes the following specific steps:
decrypting the ciphertext after error correction to obtain a source tag of the veterinary waste, and storing the source tag into a blockchain; when the veterinary waste is traced, the RFID tag of the veterinary waste is scanned, and the corresponding source mark is searched on the blockchain according to the RFID tag, so that the tracing of the veterinary waste is realized.
Preferably, the encrypting the source tag to obtain the ciphertext includes the following specific steps:
and encrypting the source mark by adopting an AES encryption algorithm to obtain a ciphertext.
The invention also provides a blockchain-based veterinary waste traceability management system, which comprises a memory, a processor and a computer program stored in the memory and capable of running on the processor, wherein the processor realizes the steps of any blockchain-based veterinary waste traceability management method when executing the computer program.
The technical scheme of the invention has the beneficial effects that: the invention carries out source marking on veterinary wastes, encrypts the source marking to obtain ciphertext, divides the ciphertext into a plurality of segments, combines the segments to obtain all combination modes, obtains the preferential degree of each combination mode according to the segments contained in each combination mode, screens the optimal combination mode, and can realize the quick positioning of the possible positions of error codes through the optimal combination mode screened by the preferential degree, thereby improving the error correction efficiency. And calculating the segments included in each combination in the optimal combination mode, obtaining the secret value of each combination, obtaining the hash value of the secret value of each combination, serving as the verification hash of each combination, performing tamper-proof verification and error correction on the ciphertext according to the ciphertext and the verification hash of each combination, and performing veterinary waste tracing according to the ciphertext after error correction. The invention can realize tamper-proof verification and error correction in the process of tracing the veterinary waste, solves the problem that tamper and error code cannot be distinguished in the prior art, and ensures that the tracing of the veterinary waste is more accurate and reliable.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described, it being obvious that the drawings in the following description are only some embodiments of the invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of steps of a blockchain-based veterinary waste provenance management method of the present invention.
Detailed Description
In order to further describe the technical means and effects adopted by the invention to achieve the preset aim, the following detailed description is given below of the specific implementation, structure, characteristics and effects of the blockchain-based waste traceability management method for veterinarian according to the invention in combination with the accompanying drawings and the preferred embodiments. In the following description, different "one embodiment" or "another embodiment" means that the embodiments are not necessarily the same. Furthermore, the particular features, structures, or characteristics of one or more embodiments may be combined in any suitable manner.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.
The following specifically describes a specific scheme of the block-chain-based veterinary waste traceability management method provided by the invention with reference to the accompanying drawings.
Referring to fig. 1, a flowchart of steps of a method for managing traceability of waste for veterinary use based on blockchain according to an embodiment of the invention is shown, the method includes the following steps:
s001, marking sources of veterinary wastes.
The veterinary waste disposal personnel packs the veterinary waste and distributes an RFID label to the packed veterinary waste, and the veterinary waste disposal personnel scans the RFID label to mark the type, the quantity, the packing time, the packing personnel, the veterinary hospitals and other information of the veterinary waste as the source of the veterinary waste and correlate the information with the RFID label.
The source mark of the veterinary waste is associated with the RFID tag, in fact, the source mark of the veterinary waste and the corresponding relation between the source mark and the RFID tag are stored in the blockchain, and then the corresponding source mark is searched on the blockchain according to the RFID tag by scanning the RFID tag of the veterinary waste, so that the traceability of the veterinary waste is realized.
Thus, the source marking of the waste for veterinarian is realized.
S002, encrypting the source mark to obtain the ciphertext.
It should be noted that, in the process of storing the source tag of the veterinary waste into the blockchain, the source tag may be stolen by an attacker to make the source tag pseudo, so that the source tag needs to be encrypted, and the blockchain stores the source tag of the veterinary waste according to the ciphertext.
In the embodiment of the invention, an AES encryption algorithm is adopted to encrypt the source mark to obtain the ciphertext. It should be noted that, in the embodiment of the present invention, only the AES encryption algorithm is described as an example, the encryption method is not limited, and in other embodiments, an operator may select the encryption algorithm according to the actual implementation situation.
Thus, encryption of the source mark is realized, and the ciphertext is obtained.
S003, dividing the ciphertext into a plurality of segments.
Note that, before the ciphertext is stored in the blockchain, the ciphertext may be subjected to error codes or may be tampered with by an attacker. At present, tamper-proof verification is usually performed through a hash value, when a ciphertext is changed, the hash value of the ciphertext is changed, and whether the ciphertext is changed can be identified through the change condition of the hash value of the ciphertext. If the ciphertext is tampered, most bits in the ciphertext can change, so that the ciphertext cannot be decrypted correctly, and the influence of tampering is large. If the ciphertext has error codes, the error codes are usually only few bit errors, and the influence of the error codes is small, but due to the hash property of the hash, one bit error of the ciphertext can cause the hash values to be quite different, so that the tampering and the error codes cannot be distinguished through the change condition of the hash values of the ciphertext.
Therefore, in the embodiment of the invention, the ciphertext is segmented so as to be convenient for grouping the segments later, the hash value of the secret value of each group is saved, and the falsification and the error code are distinguished by the proportion of hash value errors of the secret values of all groups. The embodiment of the invention adopts a chaotic mapping method to segment the ciphertext, prevents an attacker from guessing the segmentation, and specifically comprises the following steps:
in the embodiment of the invention, the key is setWherein->For bifurcation parameters, the value range is (3.57,4), ->The value range is (0, 1) for the initial value parameter>For the iteration parameter, the value range is (30,)>). It should be noted that, the key in the embodiment of the present invention is used as a dividing position for obtaining the ciphertext according to the chaotic mapping in the following, so that the value range of each parameter in the key is determined by the principle of the chaotic mapping, and will not be described in detail herein.
The number of preset segmentsFor segmenting ciphertext, the practitioner can set the number of segments according to the actual implementation, e.g. +.>
According to the secret keyGenerating length of +.>Is +.>The fraction in between.
Obtaining the length of ciphertextThe first part of the chaotic sequence>To->The individual elements are multiplied by +.>Then, rounding upwards to obtain ++>Personal->Integers between, will this->Personal->The integers in between are used as a starting index respectively. By>To->The individual elements are multiplied by +.>Then, rounding upwards to obtain ++>Personal->Integers between, will this->Personal->The integers between are respectively used as a segment length. Wherein->To take the sign of the upward value.
Obtaining the segment length corresponding to each initial index, e.g. the firstStart index->Corresponding->Length of each segment->
According to the segment length corresponding to each initial index, the segment corresponding to each initial index in the ciphertext is obtained, and the embodiment of the invention uses the th stepStart index->The following are described as examples: the index of the obtained text is->Bit of->The bit is used for obtaining the secret>For the beginning, length->As a segment. Note that, if the index in the text is +.>Bit of->After that, deficiency->A bit, then index the text as +.>Bit of->And all bits thereafter, as one segment.
To this end, a plurality of segments are acquired. It should be noted that, because the chaotic sequence obtained by the chaotic mapping is sufficiently chaotic, an attacker cannot guess the content of the chaotic sequence, and cannot guess the segments obtained according to the chaotic sequence, so that the confidentiality of the segments is ensured.
In other embodiments, the implementation personnel may segment in other manners, so long as it is ensured that the segmentation result is sufficiently confusing, and an attacker cannot guess the segmentation result.
S004, combining the segments to obtain all combination modes, and obtaining the preference degree of each combination mode to obtain the optimal combination mode.
It should be noted that, the purpose of the embodiment of the present invention is: and combining the segments to obtain the secret value of each group, further obtaining the hash value of the secret value of each group as verification hash, and distinguishing the tampering and the error code by comparing the error proportion of all verification hashes. When the error code occurs, the possible position of the error code can be obtained according to the segmentation contained in the combination corresponding to the verification hash of the error, and error correction can be performed.
In order to ensure that the possible positions of the error codes can be quickly positioned, the segments need to belong to two combinations, and when the error codes occur to the segments, the error codes of the segments contained in the two combinations can be quickly positioned according to the two combinations of verification hash errors. The grouping modes of each segment belonging to two combinations are multiple, and the embodiment of the invention obtains all grouping modes, specifically:
in the embodiment of the invention, all the segments are combined two by two, and each segment and two different segments respectively form a combination, so that a plurality of combination modes exist. For example, the segment A, the segment B, the segment C, and the segment D correspond to a combination of { (A, B), (A, C), (C, D), (B, D) }, and a combination of { (A, D), (A, C), (B, C), (B, D) }.
All combinations are obtained.
If the segments in one combination overlap with bits in the ciphertext and the error code occurs in the overlapping portion, the verification hashes of all combinations corresponding to all the segments in the combination are wrong, and at this time, the segments included in the combination with the verification hash errors are multiple, which results in a larger possible position range of the error code and slower error correction efficiency. Therefore, the number of the overlapped bits between the segments in each combination is as small as possible, the probability that the error code occurs in the overlapped part is smaller, the range of possible positions of the error code can be greatly reduced, and the segment with the error code can be rapidly positioned. Therefore, the embodiment of the invention introduces a preference index to measure the degree of overlap between the segments in each combination of each combination mode.
In the embodiment of the invention, the preference degree of each combination mode is obtained:
wherein,is->Preference degree of the seed combination mode; />Is->The length of the individual segments; />The number of the segments; />Indicate->The individual segments are at->In the corresponding first combination of the combination patterns, the first +.>The number of bits that each segment overlaps with another segment in the combination in the ciphertext; />Indicate->The individual segments are at->In the corresponding second combination of the combination patterns, the first is->The number of bits that each segment overlaps with another segment in the combination in the ciphertext; />Indicate->The individual segments are at->In the two corresponding combinations of the combination modes, except for the first->The number of bits that overlap in the ciphertext of two segments outside the segment;
wherein,indicate->The individual segments are at->The combined advantages in the combination mode are as follows +.>The individual segments are at->In the two corresponding combinations in the combination mode, the fewer the number of bits overlapped in the ciphertext between every two of all the sections, the easier the subsequent sections with error codes are positioned according to verification hash of each combination, and the ∈>The individual segments are at->The greater the combined advantage in the seed combination mode;
when the first isThe longer the segments are, the greater the probability of subsequent occurrence of error codes, if +.>The segments are error coded, so that in order to ensure that the segments of the error code can be located as soon as possible, it is necessary to have +.>The two combined segments corresponding to the individual segments are as far as possible in line with +.>The overlapping degree of the segments is small, so that the possibility that the segments of the error codes positioned according to the verification hash are caused by the error codes at the overlapping position is avoided as much as possible. Thus, when->The longer the segments are, the more attention is required to the +.>The individual segments are at->The combination advantages in the combination mode are, on the contrary, when +.>The shorter the individual segments are, the more->The individual segments are at->The less attention the combined advantage in the combination of species may be, so will +.>As->Individual divisionSection is at->The weight of the combined advantage in the seed combination is determined by the +.>The combined advantages in the combination mode are weighted and summed to obtain the +.>The degree of preference of the combination.
When the preference degree of the combination mode is larger, the overlapping degree between two segments in each combination in the combination mode in the secret is smaller, the segments with error codes are positioned according to verification hashes corresponding to each combination more easily, and error correction is carried out on the segments with error codes.
In the embodiment of the invention, the combination mode with the greatest preference degree is taken as the optimal combination mode.
So far, the optimal combination mode is obtained.
S005, obtaining verification hash of each combination in the optimal combination mode.
Binary data segments corresponding to two segments in each combination in the optimal combination mode are respectively converted into decimal numbers, the decimal numbers are used as two representative values of each combination, and the two representative values of each combination are operated to obtain a secret value of each combination.
The operation on the two representative values of each combination comprises a plurality of operation methods:
in one example, the two representative values of each combination are taken as leaf nodes, a CP-ABE tree is constructed, and the value of the root node is obtained from the values of the leaf nodes as the secret value of each combination. When the two representative values of each combination are taken as leaf nodes, for example, when the representative values are 8 and 10, respectively, and f (1) =8, f (2) =10, and the polynomial of the root node is f (x) =ax+b, substituting f (1) =8, f (2) =10 to solve for a=2, b=6, then f (x) =2x+6, and the constant term of the polynomial is the secret value of the root node, then the root node is 6, and the secret value of the combination is 6.
It should be noted that, the known techniques of constructing the CP-ABE tree and obtaining the value of the root node according to the value of the leaf node are in the ciphertext policy-attribute-based encryption algorithm (CP-ABE), and will not be described in detail herein.
In another example, an addition or subtraction or multiplication or division is performed on the two representative values of each combination, and the result obtained is taken as the secret value of each combination.
A hash value of each combined secret value is obtained as a verification hash for each combination using a hash algorithm.
To this end, a verification hash for each combination is obtained.
S006, performing tamper-proof verification and error correction on the ciphertext according to the verification hash.
The blockchain obtains the ciphertext and verification Ha Xihou of each combination, and tamper-proof verification of the ciphertext is performed according to the verification hash:
preset proportional thresholdIn this embodiment->For example, without limitation, the practitioner may set the proportional threshold according to the actual implementation. And (3) acquiring a hash value of the secret value of each combination according to the ciphertext by using the method in S003 to S005, comparing the comparison hash of each combination with the verification hash as the comparison hash of each combination, and when the comparison hash of each combination is identical to the verification Ha Xidou, not tampering and error code exist. When there is a combined comparison hash and verification hash that are different, and there is more than +.>When the combined comparison hash of (2) is the same as the verification hash, the ciphertext is considered not tampered, but an error code exists. When there is no more than->When the combined comparative hash of (a) is the same as the verification hash, the secret is consideredThe ciphertext has been tampered with, at which point the ciphertext has not been authentic.
When the ciphertext is not tampered but error codes exist, all combinations of the comparison hash and the verification hash are obtained. The intersection between every two combinations is obtained, and the segments in the intersection are used as error code segments.
For each error code segment, each bit in the error code segment is modified in turn, the comparison hash of the corresponding combination is obtained by using the error code segment after each modification, and when the comparison hash and the verification Ha Xixiang are performed, the modification is stopped, and the modification result of the error code segment at the moment is taken as the correct segment.
And replacing the corresponding error code segment in the ciphertext by using all the correct segments to realize the error correction of the ciphertext.
Thus, tamper-proof verification and error correction are achieved.
It should be noted that, in the embodiment of the present invention, the hash value of the operation result between the two representative values of each combination is adopted to perform tamper proof verification and error correction, instead of the hash value of each segment, because each segment is a part of the ciphertext, an attacker traverses the ciphertext to obtain the hash value of the segment obtained by each traverse, and the segment in the embodiment of the present invention can be guessed by comparing the hash values, so that the ciphertext of the source mark and the hash value of the segment are forged, and tamper cannot be detected. And the hash value of the operation result between the two representative values of each combination is adopted, so that under the condition that an attacker does not know the operation mode, the operation result between the two representative values and the included segments of each combination are difficult to walk and guess, and the tamper resistance verification can accurately detect tampering.
S007, tracing veterinary wastes.
And decrypting the ciphertext after error correction, wherein a decryption result is a source mark of the waste for veterinarian, and the source mark is stored in the blockchain. When the veterinary waste is traced, the RFID tag of the veterinary waste is scanned, and the corresponding source mark is searched on the blockchain according to the RFID tag, so that the tracing of the veterinary waste is realized.
Through the steps, the traceability of the veterinary waste is completed.
The embodiment of the invention also provides a block chain-based veterinary waste traceability management system, which comprises a memory, a processor and a computer program stored in the memory and capable of running on the processor, wherein the processor realizes the steps of any one of the block chain-based veterinary waste traceability management methods when executing the computer program.
According to the embodiment of the invention, the source marking is carried out on the veterinary waste, the source marking is encrypted to obtain the ciphertext, the ciphertext is divided into a plurality of segments, the segments are combined to obtain all the combination modes, the preferred degree of each combination mode is obtained according to the segments contained in each combination mode, the optimal combination mode is further screened, the possible position of the error code can be rapidly positioned through the optimal combination mode screened by the preferred degree, and the error correction efficiency is improved. And calculating the segments included in each combination in the optimal combination mode, obtaining the secret value of each combination, obtaining the hash value of the secret value of each combination, serving as the verification hash of each combination, performing tamper-proof verification and error correction on the ciphertext according to the ciphertext and the verification hash of each combination, and performing veterinary waste tracing according to the ciphertext after error correction. The invention can realize tamper-proof verification and error correction in the process of tracing the veterinary waste, solves the problem that tamper and error code cannot be distinguished in the prior art, and ensures that the tracing of the veterinary waste is more accurate and reliable.
The above description is only of the preferred embodiments of the present invention and is not intended to limit the invention, but any modifications, equivalent substitutions, improvements, etc. within the principles of the present invention should be included in the scope of the present invention.

Claims (9)

1. The block chain-based veterinary waste traceability management method is characterized by comprising the following steps of:
the method comprises the steps of marking sources of veterinary wastes, wherein the sources comprise types, amounts, packing time, packing personnel and veterinary hospitals to which the veterinary wastes belong;
encrypting the source mark to obtain a ciphertext; dividing the ciphertext into a plurality of segments; combining the segments to obtain all combination modes; acquiring the preference degree of each combination mode according to the segments contained in each combination mode; taking the combination mode with the greatest preference degree as an optimal combination mode;
calculating the segments contained in each combination in the optimal combination mode to acquire the secret value of each combination; obtaining a hash value of each combined secret value as a verification hash of each combination;
the block chain performs tamper-proof verification and error correction on the ciphertext according to the ciphertext and each combined verification hash; performing veterinary waste tracing according to the corrected ciphertext;
the ciphertext is divided into a plurality of segments, and the method comprises the following specific steps:
generating a chaotic sequence by using a chaotic mapping method; the number of preset segmentsAcquiring the length of ciphertext->By adding>The individual elements are multiplied by +.>Then, upward rounding is carried out, and the obtained results are respectively used as an initial index; will be in the chaotic sequenceThe individual elements are multiplied by +.>Then, the resulting products are rounded up and used as a segment length, respectively, wherein +.>The symbol is a value symbol which is taken upwards;
obtaining the index in the text asBit of->The bit is used for obtaining the secret>For the beginning, length->As a segment, wherein +.>Is->Start index->Is->The segment lengths.
2. The blockchain-based veterinary waste traceability management method according to claim 1, wherein the steps of combining the segments to obtain all the combination modes include the following specific steps:
each segment and any two different segments are respectively formed into a combination, and the combination result is used as a combination mode; all combinations are obtained.
3. The method for traceability management of waste for a blockchain-based veterinarian according to claim 1, wherein the obtaining the preference of each combination according to the segments included in each combination comprises the following specific steps:
wherein,is->Preference degree of the seed combination mode; />Is->The length of the individual segments; />The number of the segments; />Indicate->The individual segments are at->In the corresponding first combination of the combination patterns, the first +.>The number of bits that each segment overlaps with another segment in the combination in the ciphertext; />Indicate->The individual segments are at->In the corresponding second combination of the combination patterns, the first is->The number of bits that each segment overlaps with another segment in the combination in the ciphertext; />Indicate->The individual segments are at->In the two corresponding combinations of the combination modes, except for the first->The number of bits that overlap in the ciphertext for two segments outside of the segment.
4. The method for traceability management of waste for veterinary use based on blockchain as in claim 1, wherein the computing the segments included in each combination in the optimal combination way to obtain the secret value of each combination comprises the following specific steps:
respectively converting binary data segments corresponding to two segments in each combination in the optimal combination mode into decimal numbers, and taking the decimal numbers as two representative values of each combination; and constructing a CP-ABE tree by using the two representative values of each combination as leaf nodes and using a ciphertext policy-attribute-based encryption algorithm, and acquiring the value of a root node according to the value of the leaf nodes to serve as the secret value of each combination.
5. The blockchain-based veterinary waste traceability management method according to claim 1, wherein the blockchain performs tamper-proof verification and error correction on the ciphertext according to the ciphertext and each combined verification hash, comprising the following specific steps:
the block chain acquires an optimal combination mode and a secret value of each combination in the optimal combination mode according to the ciphertext, and takes a hash value of the secret value of each combination as a comparison hash;
comparing the comparison hash and the verification hash for each combination, comprising: when the comparative hash and verification Ha Xidou of each combination are the same, there is no tampering and no error code; when the combined comparison hash and the verification hash are different, and the combined comparison hash exceeding the preset proportion threshold is the same as the verification hash, the ciphertext is considered not tampered, but the error code exists; when there is no combined comparative hash exceeding the preset proportion threshold and verification Ha Xixiang, the ciphertext is considered to be tampered;
when the ciphertext is not tampered, but error codes exist, error correction is performed on the ciphertext.
6. The blockchain-based veterinary waste traceability management method according to claim 5, wherein the error correction of ciphertext comprises the following specific steps:
acquiring intersections between all combinations of which the comparison hash and the verification hash are different from each other, and taking the segments in the intersections as error code segments;
for each error code segment, sequentially modifying each bit in the error code segment, acquiring a comparison hash of a corresponding combination by using each modified error code segment, stopping modification when the comparison hash is verified Ha Xixiang, and taking the modification result of the error code segment at the moment as a correct segment;
and replacing the corresponding error code segment in the ciphertext by using all the correct segments to realize the error correction of the ciphertext.
7. The blockchain-based waste traceability management method for veterinarian according to claim 1, wherein the step of performing the waste traceability for veterinarian based on the corrected ciphertext comprises the following specific steps:
decrypting the ciphertext after error correction to obtain a source tag of the veterinary waste, and storing the source tag into a blockchain; when the veterinary waste is traced, the RFID tag of the veterinary waste is scanned, and the corresponding source mark is searched on the blockchain according to the RFID tag, so that the tracing of the veterinary waste is realized.
8. The blockchain-based veterinary waste traceability management method according to claim 1, wherein the encrypting the source tag to obtain the ciphertext comprises the following specific steps:
and encrypting the source mark by adopting an AES encryption algorithm to obtain a ciphertext.
9. A blockchain-based veterinary waste provenance management system comprising a memory, a processor and a computer program stored in the memory and running on the processor, wherein the processor, when executing the computer program, implements the steps of the method of any of claims 1-8.
CN202311586555.4A 2023-11-27 2023-11-27 Block chain-based veterinary waste traceability management method and system Active CN117291750B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311586555.4A CN117291750B (en) 2023-11-27 2023-11-27 Block chain-based veterinary waste traceability management method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311586555.4A CN117291750B (en) 2023-11-27 2023-11-27 Block chain-based veterinary waste traceability management method and system

Publications (2)

Publication Number Publication Date
CN117291750A CN117291750A (en) 2023-12-26
CN117291750B true CN117291750B (en) 2024-02-06

Family

ID=89253928

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311586555.4A Active CN117291750B (en) 2023-11-27 2023-11-27 Block chain-based veterinary waste traceability management method and system

Country Status (1)

Country Link
CN (1) CN117291750B (en)

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106612172A (en) * 2016-07-15 2017-05-03 四川用联信息技术有限公司 Data change recovery algorithm capable of restoring data authenticity in cloud storage
JP2020194462A (en) * 2019-05-29 2020-12-03 株式会社ミウラ Virus-free/restoration system, virus-free/restoration method, virus-free/restoration program and recording medium
CN113141359A (en) * 2021-04-21 2021-07-20 湖南大学 Password system for privacy protection of electronic medical images of Internet of things
CN114282930A (en) * 2021-11-22 2022-04-05 红原县雪月天佑农牧科技有限公司 Livestock commodity tracing method based on block chain and Internet of things technology
CN114416862A (en) * 2020-10-28 2022-04-29 银联国际有限公司 Data processing system based on block chain, data processing method thereof and block chain network
CN114785483A (en) * 2022-05-23 2022-07-22 河南大学 Medical image safe transmission method based on half tensor product compressed sensing and mixed cloud
CN114882967A (en) * 2022-05-27 2022-08-09 潘恒杰 Patient information storage system based on big data
CN116644442A (en) * 2022-12-30 2023-08-25 中移动信息技术有限公司 File verification method, device and system based on compound encryption and storage medium
CN116895375A (en) * 2023-09-08 2023-10-17 南通大学附属医院 Medical instrument management traceability method and system based on data sharing

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106612172A (en) * 2016-07-15 2017-05-03 四川用联信息技术有限公司 Data change recovery algorithm capable of restoring data authenticity in cloud storage
JP2020194462A (en) * 2019-05-29 2020-12-03 株式会社ミウラ Virus-free/restoration system, virus-free/restoration method, virus-free/restoration program and recording medium
CN114416862A (en) * 2020-10-28 2022-04-29 银联国际有限公司 Data processing system based on block chain, data processing method thereof and block chain network
CN113141359A (en) * 2021-04-21 2021-07-20 湖南大学 Password system for privacy protection of electronic medical images of Internet of things
CN114282930A (en) * 2021-11-22 2022-04-05 红原县雪月天佑农牧科技有限公司 Livestock commodity tracing method based on block chain and Internet of things technology
CN114785483A (en) * 2022-05-23 2022-07-22 河南大学 Medical image safe transmission method based on half tensor product compressed sensing and mixed cloud
CN114882967A (en) * 2022-05-27 2022-08-09 潘恒杰 Patient information storage system based on big data
CN116644442A (en) * 2022-12-30 2023-08-25 中移动信息技术有限公司 File verification method, device and system based on compound encryption and storage medium
CN116895375A (en) * 2023-09-08 2023-10-17 南通大学附属医院 Medical instrument management traceability method and system based on data sharing

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
对一类迭代混沌分组密码的分析与改进;刘加伶;计算机科学;第35卷(第6期);原文第141-144页 *

Also Published As

Publication number Publication date
CN117291750A (en) 2023-12-26

Similar Documents

Publication Publication Date Title
US9977918B2 (en) Method and system for verifiable searchable symmetric encryption
JP6929776B2 (en) Cryptographic key generation from a physically non-replicatable function
JP4209425B2 (en) Tag privacy protection method, tag device, back-end device, program thereof, and recording medium storing these programs
CN1795471B (en) Security key generation method
TW201812638A (en) Storage design method of blockchain encrypted radio frequency chip
US20050262347A1 (en) Watermark insertion apparatus and watermark extraction apparatus
CN106612172A (en) Data change recovery algorithm capable of restoring data authenticity in cloud storage
CN105099652B (en) Data encryption, decryption method and device
CN100401309C (en) Tax controlling equipment software edition intelligent upgrade encryption identification method
CN102880061A (en) Bit error correction for error caused during the process for clearing the aging in bit pattern
CN104317823B (en) A kind of method utilizing data fingerprint to carry out Data Detection
JP2021534519A (en) Systems and methods for identifying product identity
KR20140011534A (en) Generating and verifying the alternative data in a specified format
Skoric et al. The spammed code offset method
CN117291750B (en) Block chain-based veterinary waste traceability management method and system
JP6743702B2 (en) MAC tag list generation device, MAC tag list verification device, MAC tag list generation method, MAC tag list verification method and program
CN111711671B (en) Cloud storage method for updating efficient ciphertext file based on blind storage
JP6534913B2 (en) Information processing apparatus and fraudulent message detection method
AU2012382467A1 (en) A method of cryption
CN105765896A (en) A computing device for iterative application of table networks
CN105718978B (en) QR code generation method and device, and decoding method and device
CN116506230B (en) Data acquisition method and system based on RSA asymmetric encryption
CN103824197A (en) Anti-counterfeit code generating device
WO2019114084A1 (en) Encrypting/decrypting method for multi-digit number and encrypting/decrypting server
CN103502996B (en) Anti-double increment information object

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant