CN114679300A - Data verification method and device, electronic equipment and storage medium - Google Patents

Data verification method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN114679300A
CN114679300A CN202210185740.1A CN202210185740A CN114679300A CN 114679300 A CN114679300 A CN 114679300A CN 202210185740 A CN202210185740 A CN 202210185740A CN 114679300 A CN114679300 A CN 114679300A
Authority
CN
China
Prior art keywords
information
check code
check
data
target object
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.)
Granted
Application number
CN202210185740.1A
Other languages
Chinese (zh)
Other versions
CN114679300B (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.)
Foss Hangzhou Intelligent Technology Co Ltd
Original Assignee
Foss Hangzhou Intelligent 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 Foss Hangzhou Intelligent Technology Co Ltd filed Critical Foss Hangzhou Intelligent Technology Co Ltd
Priority to CN202210185740.1A priority Critical patent/CN114679300B/en
Publication of CN114679300A publication Critical patent/CN114679300A/en
Application granted granted Critical
Publication of CN114679300B publication Critical patent/CN114679300B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/12Applying verification of the received information
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L1/00Arrangements for detecting or preventing errors in the information received
    • H04L1/004Arrangements for detecting or preventing errors in the information received by using forward error control
    • H04L1/0056Systems characterized by the type of code used
    • H04L1/0061Error detection codes

Abstract

The invention discloses a data verification method, a data verification device, electronic equipment and a storage medium, wherein the data verification method comprises the following steps: receiving a data packet, a first check code and first counting information sent by a target object; acquiring second counting information corresponding to the target object; according to the data packet, obtaining a second check code corresponding to the target object; matching the first check code and the second check code; determining verification information based on the first counting information and the second counting information under the condition that the first verification code is matched with the second verification code; and determining the error type corresponding to the first check information under the condition that the check information is the first check information. According to the technical scheme of the invention, whether the data received this time is used can be determined according to the verification information and the error type thereof, so that the support of error positioning of the data is improved.

Description

Data verification method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of data transmission and communication technologies, and in particular, to a data verification method and apparatus, an electronic device, and a storage medium.
Background
With the increasing degree of automobile electronics, the automobile industry enters the networking and digital era, and the automobile network becomes an important component of automobile electronics. Many electronic control units of modern automobiles, such as: the control system, the information system, the driving system, the sensor acquisition system, and the like are connected together by a Controller Area Network (CAN) bus to form a communication Network. The communication network becomes the medium for data transmission and information exchange between the electronic control units, so it is important to ensure the safety of data transmission on the network by adopting end-to-end (E2E) safety communication. In the operation process of the system, communication failure caused by software and hardware faults or bus network interference needs to be identified dynamically, and reliable operation of the system is guaranteed. The existing scheme only determines whether to continue processing the signal according to the checked return value, and has poor support for the specific positioning of errors.
Disclosure of Invention
The invention aims to provide a data checking method, a device, an electronic device and a storage medium, which are used for acquiring second counting information corresponding to a target object by receiving a data packet, a first checking code and first counting information sent by the target object, acquiring a second checking code corresponding to the target object according to the data packet, determining checking information based on the first counting information and the second counting information under the condition that the first checking code is matched with the second checking code, and determining an error type corresponding to the first checking information under the condition that the checking information is the first checking information, so that whether the received data is used or not can be determined according to the checking information and the error type thereof, and the support of error positioning of the data is improved.
In order to achieve the purpose, the invention provides the following scheme:
a method of data verification, the method comprising:
receiving a data packet, a first check code and first counting information sent by a target object;
acquiring second counting information corresponding to the target object;
according to the data packet, obtaining a second check code corresponding to the target object;
matching the first check code and the second check code;
Determining verification information based on the first counting information and the second counting information under the condition that the first check code is matched with the second check code;
and under the condition that the verification information is first verification information, determining an error type corresponding to the first verification information, wherein the first verification information is verified to be failed.
Optionally, after the matching processing is performed on the first check code and the second check code, the method further includes:
under the condition that the first check code and the second check code are not matched, determining that the check information is second check information;
and under the condition that the check information is the second check information, returning to the step of obtaining a second check code corresponding to the target object according to the data packet, and if the check information is still the second check information, discarding the data packet corresponding to the second check information.
Optionally, when the first check code and the second check code are matched, determining check information based on the first count information and the second count information includes:
obtaining counting difference information based on the first counting information and the second counting information;
Determining the check information as third check information under the condition that the counting difference information meets a preset threshold;
and under the condition that the counting difference information does not meet a preset threshold value, determining that the verification information is first verification information.
Optionally, determining the error type corresponding to the first check information when the check information is the first check information includes:
acquiring the mapping relation between the counting difference information and the error type;
and determining the error type corresponding to the first check information according to the counting difference information and the mapping relation.
Optionally, the data packet includes transmission data and a generator polynomial, and obtaining the second parity code corresponding to the target object according to the data packet includes:
obtaining a lookup table corresponding to the generator polynomial;
and obtaining a second check code corresponding to the target object based on the transmission data and the lookup table.
Optionally, before receiving the data packet, the first check code, and the first count information sent by the target object, the method further includes:
receiving the generator polynomial;
based on the generator polynomial, carrying out shift XOR processing by using a single byte to obtain a corresponding array table containing a plurality of preset elements;
And obtaining a lookup table corresponding to the generating polynomial according to the array table containing the plurality of preset elements respectively.
Optionally, the obtaining a second check code corresponding to the target object based on the transmission data and the lookup table includes:
taking the first byte data of the transmission data as current byte data, and performing exclusive OR on the current byte data and a redundancy check code to obtain a first exclusive OR result corresponding to the first byte data;
searching in the lookup table based on the first exclusive-or result to obtain a third check code corresponding to the first exclusive-or result;
and taking the next byte data of the first byte data in the transmission data as the current byte data, updating the redundancy check code based on the third check code, returning to the XOR of the current byte data and the redundancy check code to obtain a first XOR result corresponding to the first byte data until all byte data in the transmission data are XOR-acquired, obtaining a fourth check code corresponding to the last byte data in the transmission data, and taking the fourth check code as the second check code.
On the other hand, the invention also provides a data checking device, which comprises:
the information receiving module is used for receiving a data packet, a first check code and first counting information sent by a target object;
the first information acquisition module is used for acquiring second counting information corresponding to the target object;
the check code acquisition module is used for acquiring a second check code corresponding to the target object according to the data packet;
the matching module is used for matching the first check code and the second check code;
a check information determining module, configured to determine check information based on the first count information and the second count information when the first check code and the second check code are matched;
and the error type determining module is used for determining the error type corresponding to the first checking information under the condition that the checking information is the first checking information, wherein the first checking information is checked to be failed.
In another aspect, the present invention further provides an electronic device, including: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to perform the above data verification method.
In another aspect, the present invention also provides a non-transitory computer-readable storage medium having computer program instructions stored thereon, wherein the computer program instructions, when executed by a processor, implement the data verification method described above.
According to the data verification method, the data verification device, the electronic equipment and the storage medium, second counting information corresponding to a target object is obtained by receiving a data packet, a first verification code and first counting information sent by the target object, a second verification code corresponding to the target object is obtained according to the data packet, verification information is determined based on the first counting information and the second counting information under the condition that the first verification code is matched with the second verification code, an error type corresponding to the first verification information is determined under the condition that the verification information is the first verification information, and whether the received data is used or not can be determined according to the verification information and the error type of the verification information, so that the support of error positioning of the data is improved.
Drawings
In order to more clearly illustrate the technical solution of the present invention, the drawings used in the description of the embodiment or the prior art will be briefly described below. It is obvious that the drawings in the following description are only some embodiments of the invention, and that for a person skilled in the art it is also possible to derive other drawings from these drawings without inventive effort.
Fig. 1 is a flowchart of a method of a data verification method according to an embodiment of the present invention;
fig. 2 is a flowchart of a method after performing matching processing on a first check code and a second check code according to an embodiment of the present invention;
fig. 3 is a flowchart of a method for determining check information based on first count information and second count information when a first check code and a second check code are matched according to an embodiment of the present invention;
fig. 4 is a flowchart of a method for determining an error type corresponding to first check information when the check information is the first check information according to an embodiment of the present invention;
fig. 5 is a flowchart of a method for obtaining a second check code corresponding to a target object according to a data packet according to an embodiment of the present invention;
fig. 6 is a flowchart of a method before receiving a data packet, a first check code and first count information sent by a target object according to an embodiment of the present invention;
fig. 7 is a flowchart of a method for obtaining a second check code corresponding to a target object based on transmission data and a lookup table according to an embodiment of the present invention;
fig. 8 is a block diagram of a data verification apparatus according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be obtained by a person skilled in the art without any inventive step based on the embodiments of the present invention, are within the scope of the present invention.
In order to make the aforementioned objects, features and advantages of the present invention more comprehensible, the present invention is described in detail with reference to the accompanying drawings and the detailed description thereof.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
An embodiment of a data verification method according to the present invention is described below, and fig. 1 is a flowchart of a data verification method according to an embodiment of the present invention. It is noted that the present specification provides the method steps as described in the examples or flowcharts, but may include more or less steps based on routine or non-inventive labor. The order of steps recited in the embodiments is merely one manner of performing the steps in a multitude of orders and does not represent the only order of execution. In practice, the system products may be executed sequentially or in parallel (e.g., in the context of parallel processors or multi-threaded processing) in accordance with the methods described in the embodiments or figures. As shown in fig. 1, the present embodiment provides a data verification method, including:
s101, receiving a data packet, a first check code and first counting information sent by a target object.
The target object may refer to a sender sending a data packet. The data packets may be used to enable communication between a transmitting end and a receiving end. The first check code can be used for checking the correctness of the data packet sent by the target object; the first check code may be 8 bits, 16 bits, or 32 bits, but is not limited thereto. The first count information may characterize ordinal numbers of all packets sent by the packet relative to the target object; specifically, the first count information may be a numerical value.
In practical application, a receiving end can receive data sent by a sending end; the sending end can divide the data to be sent into a plurality of data blocks and transmit the data blocks to the receiving end in the form of data packets. In order to ensure the correctness of data transmission, the data packet, the first check code and the first counting information may be sent to the receiving end, so that the receiving end checks the data packet according to the first check code and the first counting information.
S102, second counting information corresponding to the target object is obtained.
The second count information may be count information corresponding to a latest packet transmitted by the target object before the current time.
In practical applications, before the first data transmission of the target object is started, that is, when the target object does not send data to the receiving end, the second count information corresponding to the target object in the memory may be set to an initial value, specifically, the initial value may be 0; under the condition of receiving a data packet, a first check code and first count information sent by a first target object, where the first count information may be 1, after a receiving end completes the check of the data packet, a second count information corresponding to the target object in a memory may be updated according to the first count information and identification information of the target object in a corresponding data packet, for example, the second count information whose value is 0 may be updated to 1; and after receiving the data packet sent by the target object and completing the verification of the data packet each time, the second counting information in the memory can be updated. When the data packet, the first check code, and the first count information sent by the target object are received, the second count information corresponding to the target object may be acquired in the memory according to the identification information of the target object.
And S103, acquiring a second check code corresponding to the target object according to the data packet.
The second check code may be a check code calculated by the receiving end according to data in the data packet and used for checking. In this embodiment, the first check code and the second check code may be cyclic redundancy check codes.
In practical applications, the second parity code may be calculated according to the data packet by using a direct calculation method or a table lookup method.
And S104, matching the first check code and the second check code.
In practical application, the first check code and the second check code can be compared and matched bit by bit. It can be understood that if at least one bit of the first check code is different from that of the second check code, the first check code is not matched with the second check code; if each bit in the first check code and the second check code is identical, the first check code and the second check code can be considered to be matched.
And S105, under the condition that the first check code and the second check code are matched, determining check information based on the first counting information and the second counting information.
The check information may represent a check result of checking the data packet. The verification information may include first verification information, second verification information, and third verification information; specifically, the first check information may be information that does not pass the check if the check codes match, the second check information may be information that does not pass the check due to mismatch of the check codes, and the third check information may be information that passes the check.
In practical application, under the condition that the first check code is matched with the second check code, the difference between the first count information and the second count information can be obtained based on the first count information and the second count information, and then the check information can be determined according to the difference between the first count information and the second count information. Illustratively, when the difference value between the first count information and the second count information is 1, the check information may be third check information; when the difference between the first count information and the second count information is not 1, the check information may be the first check information.
And S106, under the condition that the verification information is the first verification information, determining the error type corresponding to the first verification information, wherein the first verification information is that the verification fails.
The error type may represent a reason why the data of the data packet is not verified. The error types can include check code error, data normal, repeat transmission, data frame loss.
In practical application, a corresponding relation between a difference value between the first counting information and the second counting information and an error type can be established in advance; based on the first counting information and the second counting information, a difference value between the first counting information and the second counting information can be calculated, and an error type corresponding to the first checking information can be obtained through table lookup.
The method comprises the steps of obtaining second counting information corresponding to a target object by receiving a data packet, a first check code and first counting information sent by the target object, obtaining a second check code corresponding to the target object according to the data packet, determining check information based on the first counting information and the second counting information under the condition that the first check code is matched with the second check code, and determining an error type corresponding to the first check information under the condition that the check information is the first check information, so that whether the received data is used or not can be determined according to the check information and the error type thereof, and the support of error positioning of the data is improved.
Fig. 2 is a flowchart of a method after performing matching processing on a first check code and a second check code according to an embodiment of the present invention. In a possible embodiment, as shown in fig. 2, after the matching processing is performed on the first check code and the second check code, the method may further include:
s201, under the condition that the first check code and the second check code are not matched, the check information is determined to be second check information.
In practical applications, the condition that the first check code and the second check code are not matched may mean that at least one character bit of the first check code and the second check code are different from each other. It can be understood that, in a case that the first check code and the second check code do not match, that is, the second check code calculated by the data packet is different from the first check code, it may be considered that there may be an error in the data packet.
S202, under the condition that the check information is the second check information, the step of obtaining a second check code corresponding to the target object according to the data packet is returned, and if the check information is still the second check information, the data packet corresponding to the second check information is discarded.
In practical application, when the verification information obtained by performing the first verification on the data packet is the second verification information, the second verification can be performed by returning the step of obtaining the second verification code corresponding to the target object according to the data packet. When the verification information obtained after the second verification is the third verification information, the verification is considered to be passed, the data in the data packet is correct, and the data in the data packet can be used; if the check information obtained after the second check is still the second check information, it may be considered that there may be an error in the data packet, and the data packet is discarded.
Under the condition that the first check code and the second check code are not matched, the data packet is checked for the second time, loss of the data packet caused by errors in the checking process is avoided, and the success rate of data transmission can be further improved.
Fig. 3 is a flowchart of a method for determining check information based on first count information and second count information when a first check code and a second check code match according to an embodiment of the present invention. In one possible embodiment, as shown in fig. 3, the step S105 may include:
And S301, obtaining counting difference value information based on the first counting information and the second counting information.
The counting difference information may represent a timing relationship between a currently received data packet and a last previously received data packet. The count difference information may be a difference between the first count information and the second count information.
In practical application, the counting difference information can be obtained by taking the difference value according to the first counting information and the second counting information.
S302, under the condition that the counting difference value information meets a preset threshold value, the verification information is determined to be third verification information.
And S303, under the condition that the counting difference information does not meet the preset threshold value, determining that the verification information is first verification information.
The preset threshold may be set according to actual needs. For example, for software components with different security levels, the check information can be flexibly determined according to the count difference information, and whether to use the received data and whether to report a fault can be determined according to the check information.
In practical applications, for the collision management module, the preset threshold may be greater than or equal to 1 and less than or equal to 3; if the counting difference information is 4 under the condition that the first check code is matched with the second check code, and the check information is determined to be the first check information, the whole vehicle system can perform power reduction action, and report the collision signal loss fault to the fault management module. The safety requirement on the storage battery voltage management module is relatively low, the preset threshold value CAN be more than or equal to 1 and less than 15, the CAN network communication CAN be judged to be normal under the condition that the check code check is discontinuous and wrong twice and the counting difference value information meets the preset threshold value, the data which cannot pass the check of the first check code and the second check code in twice are discarded, the previous value is kept, and the fault is not reported.
Fig. 4 is a flowchart of a method for determining an error type corresponding to first check information when the check information is the first check information according to an embodiment of the present invention. In one possible embodiment, as shown in fig. 4, the step S106 may include:
s401, obtaining the mapping relation between the counting difference information and the error type.
The mapping relationship between the count difference information and the error type can be used for determining the error type corresponding to the data packet. The mapping relationship can be pre-established according to actual needs.
In practical applications, the mapping table between the count difference information and the error type may be as follows:
count difference information Type of error
0 Repeating transmission
1 Data Normal
Within a predetermined range (e.g., 3 or less) Data frame loss within tolerance range
Out of the predetermined range (e.g. 3 or less) Data loss frame
In the table, the repeated transmission may mean that the content of the data packet transmitted this time and the data packet transmitted last time by the target object may be repeated; the data is normal, that is, the data in the data packet is sent correctly; the data loss frame within the tolerance range can mean that data loss which is supposed to be sent exists between the current data packet and the last data packet and is not received but acceptable; the data loss frame may refer to an error that data is lost between the current data packet and the last data packet.
S402, determining the error type corresponding to the first check information according to the counting difference information and the mapping relation.
In practical applications, the error type corresponding to the count difference information may be obtained according to the count difference information and the mapping relationship between the count difference information and the error type, so that the error type corresponding to the first check information may be obtained. By counting the mapping relation between the difference information and the error type, the corresponding error type can be quickly determined, so that the receiving end can quickly confirm the corresponding error reason of the data packet.
Fig. 5 is a flowchart of a method for obtaining a second check code corresponding to a target object according to a data packet according to an embodiment of the present invention. In one possible embodiment, the data packet includes transmission data and a generator polynomial, and as shown in fig. 5, the step S103 may include:
s501, obtaining a lookup table corresponding to the generating polynomial.
The generator polynomial may be used to convert transmission data to be error-protected to generate a second parity code. If all the code word polynomials of a cyclic code are multiples of a non-zero first polynomial g (x) of the lowest degree, then g (x) is called to generate the code, and g (x) is called the generator or generator polynomial of the code. The generator polynomial is the convention between the receiving end and the transmitting end, and can be a binary number, and the number is always kept unchanged in the whole transmission process. For the sending end, the generating polynomial can be utilized to carry out modulo-2 division on the information polynomial to generate a check code; and for the receiving end, performing modulo-2 division on the received coding polynomial by using the generating polynomial to detect. The look-up table may be used in a calculation process to obtain the second check code. For an 8-bit check code, the size of the lookup table is 256 bytes; for a 16-bit check code, the size of the lookup table is 512 bytes; for a 32-bit check code, the size of the lookup table is 1024 bytes.
In practical application, before the sending end transmits data to the receiving end, the sending end may receive a preset generator polynomial and send the generator polynomial to the receiving end; after receiving the generator polynomial, the receiving end may generate a lookup table according to the generator polynomial and store the lookup table in the memory, so that the receiving end may read the corresponding lookup table in the memory based on the generator polynomial when the receiving end needs to calculate the second check code from the lookup table.
S502, obtaining a second check code corresponding to the target object based on the transmission data and the lookup table.
For different generating polynomials, different lookup tables are generated to calculate the second check code, so that the method has good flexibility, can meet the setting requirements of different generating polynomials, and improves the portability of the end-to-end check module.
In one possible implementation, as shown in fig. 7, the step S502 may include:
s701, taking the first byte data of the transmission data as current byte data, and performing XOR on the current byte data and the redundancy check code to obtain a first XOR result corresponding to the first byte data.
Wherein the transmission data may be a binary code stream. The first byte of data may refer to the character of the first bit in the transfer data in order from left to right. The current byte data may refer to data that is currently xored with the redundancy check code. The redundancy check code may be used for exclusive-or with the current byte data, and may be an initial value, for example, 0xFF, before exclusive-or with the first byte data.
S702, searching in a lookup table based on the first XOR result to obtain a third check code corresponding to the first XOR result.
In practical applications, for a lookup table comprising 256 elements, the 256 elements may respectively correspond to values 0 to 255 in sequence, that is, each value corresponds to one element; and converting the first XOR result into a numerical value, finding a corresponding element based on the numerical value, and taking the element as a third check code.
And S703, taking the next byte data of the first byte data in the transmission data as the current byte data, updating the redundancy check code based on the third check code, returning to the XOR of the current byte data and the redundancy check code to obtain a first XOR result corresponding to the first byte data until all byte data in the transmission data are XOR-acquired, obtaining a fourth check code corresponding to the last byte data in the transmission data, and taking the fourth check code as the second check code.
In practical application, after the xor is taken for the first byte data and the third check code is obtained by looking up a table according to the result, the second byte data can be used as the current byte data, the third check code is used as the redundancy check code to update the redundancy check code, and then the xor is taken for the current byte data and the redundancy check code to obtain the first xor result corresponding to the first byte data, so that the check code corresponding to the second byte data can be obtained, and accordingly, the cyclic reciprocation can be performed to obtain the fourth check code corresponding to the last byte data, and the fourth check code can be used as the second check code.
By searching and obtaining the second check code corresponding to the transmission data based on the lookup table, the time consumption caused by calculation can be reduced, the operation time is shortened, and the real-time processing of the signal data is ensured.
Fig. 6 is a flowchart of a method before receiving a data packet, a first check code, and first count information sent by a target object according to an embodiment of the present invention. In one possible embodiment, as shown in fig. 6, before receiving the data packet, the first check code, and the first count information sent by the target object, the method may further include:
s601, receiving a generating polynomial;
s602, based on a generating polynomial, carrying out shift XOR (exclusive OR) processing on a single byte to obtain a corresponding array table comprising a plurality of preset elements;
s603, obtaining a lookup table corresponding to the generating polynomial according to the array table containing a plurality of preset elements.
In practical application, for an 8-bit check code, an array containing 256 elements can be defined firstly, accumulation is started from 0, the value accumulated each time is used as input of calculation, shifting is carried out to judge whether each bit is 1, and if the value is 1, bitwise exclusive or is carried out on the bit and a generator polynomial; if not 1, the left shift is continued until 8 shifts are completed. And storing the obtained result as an array element into a table until all accumulated values corresponding to 0 to 255 are subjected to bitwise exclusive OR with the generator polynomial, and finally obtaining a lookup table containing 256 elements.
Fig. 8 is a block diagram of a data verification apparatus according to an embodiment of the present invention. On the other hand, as shown in fig. 8, this embodiment further provides a data verification apparatus, which includes:
the information receiving module 10 is configured to receive a data packet, a first check code, and first count information sent by a target object;
the first information obtaining module 20 is configured to obtain second count information corresponding to the target object;
the check code obtaining module 30 is configured to obtain a second check code corresponding to the target object according to the data packet;
the matching module 40 is used for matching the first check code and the second check code;
a check information determining module 50, configured to determine, when the first check code and the second check code match, check information based on the first count information and the second count information;
and an error type determining module 60, configured to determine, when the verification information is the first verification information, an error type corresponding to the first verification information, where the first verification information is that the verification fails.
On the other hand, an embodiment of the present invention further provides an electronic device, including: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to perform the data verification method described above.
In another aspect, an embodiment of the present invention further provides a non-volatile computer-readable storage medium, on which computer program instructions are stored, where the computer program instructions, when executed by a processor, implement the data verification method described above.
It is noted that for the sake of simplicity, each of the above-described method embodiments is described as a series of acts, but it should be understood by those skilled in the art that the present invention is not limited by the order of acts described, as some steps may be performed in other orders or simultaneously according to the present invention. Similarly, the modules of the data verification apparatus refer to computer programs or program segments for performing one or more specific functions, and the distinction among the modules does not mean that actual program codes are necessarily separated. In addition, the above embodiments may be arbitrarily combined to obtain other embodiments.
In the foregoing embodiments, the descriptions of the embodiments have their respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described in detail in a certain embodiment. Those of skill in the art will also appreciate that the various illustrative logical blocks, elements, and steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both. To clearly illustrate the interchangeability of hardware and software, various illustrative components, elements, and steps have been described above generally in terms of their functionality. Whether such functionality is implemented as hardware or software depends upon the particular application and design requirements of the overall system. Those skilled in the art may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the embodiments of the invention.
The foregoing description has disclosed fully preferred embodiments of the present invention. It should be noted that those skilled in the art can make modifications to the embodiments of the present invention without departing from the scope of the appended claims. Accordingly, the scope of the appended claims is not to be limited to the specific embodiments described above.

Claims (10)

1. A method of data verification, the method comprising:
receiving a data packet, a first check code and first counting information sent by a target object;
acquiring second counting information corresponding to the target object;
according to the data packet, obtaining a second check code corresponding to the target object;
matching the first check code and the second check code;
determining verification information based on the first counting information and the second counting information under the condition that the first check code and the second check code are matched;
and determining the error type corresponding to the first checking information under the condition that the checking information is the first checking information, wherein the first checking information is that the checking fails.
2. The method of claim 1, wherein after the matching the first check code and the second check code, further comprising:
Under the condition that the first check code and the second check code are not matched, determining that the check information is second check information;
and under the condition that the check information is the second check information, returning to the step of obtaining a second check code corresponding to the target object according to the data packet, and if the check information is still the second check information, discarding the data packet corresponding to the second check information.
3. The method of claim 2, wherein determining the check information based on the first count information and the second count information if the first check code and the second check code match comprises:
obtaining counting difference information based on the first counting information and the second counting information;
determining the verification information as third verification information under the condition that the counting difference information meets a preset threshold value;
and under the condition that the counting difference information does not meet a preset threshold value, determining that the verification information is first verification information.
4. The method according to claim 3, wherein the determining the error type corresponding to the first check information in the case that the check information is the first check information includes:
Acquiring the mapping relation between the counting difference information and the error type;
and determining the error type corresponding to the first check information according to the counting difference information and the mapping relation.
5. The method of claim 1, wherein the data packet includes transmission data and a generator polynomial, and the obtaining the second parity code corresponding to the target object according to the data packet includes:
obtaining a lookup table corresponding to the generator polynomial;
and obtaining a second check code corresponding to the target object based on the transmission data and the lookup table.
6. The method of claim 5, wherein before receiving the data packet, the first check code and the first count information sent by the target object, the method further comprises:
receiving the generator polynomial;
based on the generator polynomial, carrying out shift XOR processing by using a single byte to obtain a corresponding array table containing a plurality of preset elements;
and obtaining a lookup table corresponding to the generating polynomial according to the array table containing the plurality of preset elements respectively.
7. The method of claim 6, wherein obtaining the second parity code corresponding to the target object based on the transmission data and the lookup table comprises:
Taking first byte data of the transmission data as current byte data, and performing exclusive OR on the current byte data and a redundancy check code to obtain a first exclusive OR result corresponding to the first byte data;
searching in the lookup table based on the first XOR result to obtain a third check code corresponding to the first XOR result;
and taking the next byte data of the first byte data in the transmission data as the current byte data, updating the redundancy check code based on the third check code, and returning to the XOR of the current byte data and the redundancy check code to obtain a first XOR result corresponding to the first byte data until all byte data in the transmission data are XOR-acquired, so as to obtain a fourth check code corresponding to the last byte data in the transmission data, and taking the fourth check code as the second check code.
8. A data verification apparatus, the apparatus comprising:
the information receiving module is used for receiving a data packet, a first check code and first counting information sent by a target object;
the first information acquisition module is used for acquiring second counting information corresponding to the target object;
The check code acquisition module is used for acquiring a second check code corresponding to the target object according to the data packet;
the matching module is used for matching the first check code and the second check code;
a check information determining module, configured to determine check information based on the first count information and the second count information when the first check code and the second check code are matched;
and the error type determining module is used for determining the error type corresponding to the first checking information under the condition that the checking information is the first checking information, wherein the first checking information is not passed through the checking.
9. An electronic device, comprising:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to execute the executable instructions to implement the data verification method of any one of claims 1 to 7.
10. A non-transitory computer readable storage medium having stored thereon computer program instructions, wherein the computer program instructions, when executed by a processor, implement the data verification method of any one of claims 1 to 7.
CN202210185740.1A 2022-02-28 2022-02-28 Data verification method and device, electronic equipment and storage medium Active CN114679300B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210185740.1A CN114679300B (en) 2022-02-28 2022-02-28 Data verification method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210185740.1A CN114679300B (en) 2022-02-28 2022-02-28 Data verification method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN114679300A true CN114679300A (en) 2022-06-28
CN114679300B CN114679300B (en) 2023-10-13

Family

ID=82071742

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210185740.1A Active CN114679300B (en) 2022-02-28 2022-02-28 Data verification method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114679300B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117336395A (en) * 2023-12-01 2024-01-02 杭州乾景科技有限公司 Underground communication data processing method and device and electronic equipment

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6931581B1 (en) * 2000-10-25 2005-08-16 Sun Microsystems, Inc. Method for superimposing a sequence number in an error detection code in a data network
CN103345487A (en) * 2013-06-24 2013-10-09 北京奇虎科技有限公司 Method and system of verifying data consistency between multiple platforms
CN203761409U (en) * 2014-01-26 2014-08-06 中国电子科技集团公司第五十八研究所 Low-cost and high-reliability high-speed network communication chip test circuit
CN105786639A (en) * 2016-03-01 2016-07-20 上海斐讯数据通信技术有限公司 I2C buss data transmission method and system
CN105871802A (en) * 2015-12-07 2016-08-17 乐视云计算有限公司 Method, device and system for monitoring transmission of streaming media file
US9705678B1 (en) * 2014-04-17 2017-07-11 Symantec Corporation Fast CAN message authentication for vehicular systems
CN111328104A (en) * 2018-12-14 2020-06-23 华为技术有限公司 Data packet decompression method and device
CN112305492A (en) * 2020-10-30 2021-02-02 国网山东省电力公司营销服务中心(计量中心) Intelligent electric energy meter online error check accurate control system and method thereof
CN112564863A (en) * 2020-12-24 2021-03-26 中国兵器装备集团自动化研究所 Communication timeliness error detection system and detection method
CN113517950A (en) * 2021-04-30 2021-10-19 山东英信计算机技术有限公司 Signal receiving and transmitting method, system and medium

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6931581B1 (en) * 2000-10-25 2005-08-16 Sun Microsystems, Inc. Method for superimposing a sequence number in an error detection code in a data network
CN103345487A (en) * 2013-06-24 2013-10-09 北京奇虎科技有限公司 Method and system of verifying data consistency between multiple platforms
CN203761409U (en) * 2014-01-26 2014-08-06 中国电子科技集团公司第五十八研究所 Low-cost and high-reliability high-speed network communication chip test circuit
US9705678B1 (en) * 2014-04-17 2017-07-11 Symantec Corporation Fast CAN message authentication for vehicular systems
CN105871802A (en) * 2015-12-07 2016-08-17 乐视云计算有限公司 Method, device and system for monitoring transmission of streaming media file
CN105786639A (en) * 2016-03-01 2016-07-20 上海斐讯数据通信技术有限公司 I2C buss data transmission method and system
CN111328104A (en) * 2018-12-14 2020-06-23 华为技术有限公司 Data packet decompression method and device
CN112305492A (en) * 2020-10-30 2021-02-02 国网山东省电力公司营销服务中心(计量中心) Intelligent electric energy meter online error check accurate control system and method thereof
CN112564863A (en) * 2020-12-24 2021-03-26 中国兵器装备集团自动化研究所 Communication timeliness error detection system and detection method
CN113517950A (en) * 2021-04-30 2021-10-19 山东英信计算机技术有限公司 Signal receiving and transmitting method, system and medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
王飞等: "IEC61784-3:2017安全通信协议设计与残余差错率计算", 电气防爆, vol. 1, no. 1 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117336395A (en) * 2023-12-01 2024-01-02 杭州乾景科技有限公司 Underground communication data processing method and device and electronic equipment
CN117336395B (en) * 2023-12-01 2024-03-12 杭州乾景科技有限公司 Underground communication data processing method and device and electronic equipment

Also Published As

Publication number Publication date
CN114679300B (en) 2023-10-13

Similar Documents

Publication Publication Date Title
US7640480B2 (en) Detection of errors in the communication of data
US4809273A (en) Device for verifying operation of a checking code generator
CN107888344B (en) Method, equipment and system for detecting error code
CN108337069B (en) Improved error rate reducing end parallel grouping CRC (Cyclic redundancy check) system
CN114679300B (en) Data verification method and device, electronic equipment and storage medium
CN105612697B (en) Accumulated error detection in data transmission
CN106372026B (en) link detection method and receiving equipment
KR101334017B1 (en) Apparatus of checking a validity of message on network for a vehicle and method of thereof
CN110806948A (en) Data verification method and device
EP1762006A1 (en) Data processing
US20170077952A1 (en) Sensor interface that provides a long package crc to improve functional safety
US7673214B2 (en) Message error verification using checking with hidden data
CN108270508B (en) Cyclic redundancy check CRC implementation method, device and network equipment
JP3217716B2 (en) Wireless packet communication device
US6915471B2 (en) Encoder and method for encoding data
CN114513285B (en) Method, device, equipment and readable storage medium for detecting and correcting transmission data
Juan et al. FPGA implementation of hamming code for increasing the frame rate of CAN communication
CN112821984B (en) Method, device and equipment for processing wireless local area network data
US20040153945A1 (en) Error correction circuit employing cyclic code
Jain et al. Cyclic Redundancy Codes: Study and Implementation
WO2013080481A1 (en) Communication device, communication method, and communication program
US20230412284A1 (en) Method for communicating information, receiver device, sensor device, and system
US11871166B2 (en) Sensor system
US20090150727A1 (en) Data transmission method
Juan et al. Development of a reduction algorithm for CAN frame bits

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