-
private sub command1 click()dim data() as byte
DIM check digit as integer
dim bytes as long
dim low as boolean
Checksum = -1
Data = strconv(text1, vbfromunicode) bytes = ubound(data).
for i = 0 to bytes.
Low = ture
for j = 1 to 8
If the low bit then checksum = checksum xor data (i) low bit = data (i) and 1
Data (i) = Data (i) 2
next j
next i
text2 = hex (checksum).
end sub
That's pretty much the way the algorithm goes.
-
Calculation method of CRC checksum:
1. Cyclic check code (CRC code): It is the most commonly used error check code in the field of data communication, and the feature of the bridge is that the length of the information field and the check field can be arbitrarily selected.
2. The basic principle of generating CRC code: any ** composed of binary bit strings can correspond one-to-one with a polynomial with coefficients only the values of '0' and '1'.
For example, the polynomial corresponding to the 1010111 is x6+x4+x2+x+1, and the polynomial is the **101111 corresponding to x5+x3+x2+x+1.
Precautions
It is a convention between the receiver and the sender, that is, a binary number that remains constant throughout the transmission.
On the sender, the generated polynomial is used to modulo 2 the information polynomial by generating a check code. On the receiving side, the received coded polynomial is modulo2 by generating multi-ballast terms, and the error location is detected and determined.
The following conditions should be met: Tsai Lumeng.
1. The highest and lowest digits of the generated polynomial must be 1.
2. When there is an error in any digit of the transmitted information (CRC code), the remainder should not be 0 after the division of the generated polynomial.
3. When there is an error in different bits, the remainder should be different.
4. Continue to divide the remainder, and make the remainder circular.
-
1. Cyclic check code (CRC code): It is the most commonly used error check code in the field of data communication, which is characterized by the fact that the length of the information field and the check field can be arbitrarily selected.
2. The basic principle of generating CRC code: any ** composed of binary bit strings can correspond one-to-one with a polynomial with coefficients only the values of '0' and '1'.
For example, the polynomial corresponding to the 1010111 is x6+x4+x2+x+1, and the polynomial is the **101111 corresponding to x5+x3+x2+x+1.
-
If the information bit is known to be 1100, the polynomial g(x) =x3+x+1 is generated, and the CRC code is found.
m(x) =1100 m(x)*x3 = 1100000 g(x) =1011
m(x)*x3 / g(x) =1110 + 010 /1011 r(x) =010
The CRC code is: m(x)*x 3+r(x)=1100000+010=1100010
The principle is: the CRC code is generally generated by splicing the R-bit check bit after the K-bit information bit. The coding steps are as follows:
1) Represent the k-bit information to be encoded as a polynomial m(x).
2) Shift m(x) to the left by r to get m(x)*xr.
3) Remove m(x)*xr with the generative polynomial g(x) of the r+1 bit to get the remainder r(x).
4) Add M(X)*XR and R(X) as module 2 to obtain the CRC code.
-
I'll give you an example first:
Knowing that the information bit is 1100, the polynomial let g(x) =x3+x+1 is generated, and the crc code is obtained.
m(x) =1100 m(x)*x3 = 1100000 g(x) =1011
m(x)*x3 / g(x) =1110 + 010 /1011 r(x) =010
The CRC code is: m(x)*x 3+r(x)=1100000+010=1100010
The principle of hand slippage is that the CRC code is generally generated by splicing the R-bit check bit after the K-bit information bit. The coding steps are as follows:
1) Represent the k-bit information to be encoded as a polynomial m(x).
2) Shift m(x) to the left by r to get m(x)*xr.
3) Divide m(x)*xr with the polynomial g(x) of the r+1 bit to get the remainder r(x).
4) Add M(X)*XR and R(X) as module 2 to obtain the CRC code.
Proofreading, I have a complete list of Proofreading positions in my document, you can go and check out Hope.
I'm not your major, but I can provide you with my experience of applying for graduate school at that time. >>>More
The reason for the conflict between home and school is simply that the parents' expectations are not obtained from the school. This is also what I have personally learned from the observation and personal experience of other people's events. >>>More
Is it a gentleman? If you don't want to practice, don't go, just practice hard, don't be afraid of hardship. How can there be no hardship in practicing martial arts, when I was a freshman, I practiced martial arts for 4 hours a day, amateur, and no one forced anyone to take care of it. >>>More
I won't talk about how to review it specifically:
Let's first let you know the content of the graduate school entrance examination! I took the postgraduate examination this year and divided it into a preliminary examination and a re-examination, with a full score of 500 points in the preliminary examination English (100), mathematics (150), and politics (100) are national unified propositions, and there is also a professional course (150) with the proposition of the unit you are applying for. >>>More