Data check and parity check

The blog instructions

Part of the information involved in this article comes from the Internet, as well as my own summary and views. The purpose of sharing is to build the community and consolidate myself. If the information cited infringement, please contact me to delete! Thank god I was here. Thank you for coming!

preface

Data verification in school was not serious, now free, but lick the face to learn.

Data Validation: Are you polite? Have you checked your data?

Copy a copy of the title, let’s take a look at the complex data verification!

Why do we need to do data verification

Data is almost everywhere in our life, in the computer is also the most important part, can be said to be the blood of the computer. We know from previous articles that data exists in binary form on a computer. Even a very, very small piece of data, translated into binary, is huge.

In a computer, data is not immutable, it has to be moved, transferred. In this process, there may be external interference, resulting in one or more binary missing errors. (If the binary number is wrong by one bit, it’s natural.)

Therefore, without verification, it is difficult to ensure complete data. So calibration is needed, and it is necessary!

How to verify data

Data how check, ask how to prove you oneself is you like, that is to have id card of course ha.

In order to verify the data, it is not enough to have the original data, there is no way to verify the data, so you have to add extra redundancy codes, also known as check bits.

So the message sent out is the validity information (K bits) + verification information (R bits).

When a piece of data is sent through a special encoding, the receiver also uses a specific format to decode it. If the expected number is consistent, it can be judged from the subjective point of view that it is correct. But in fact, this view is not rigorous.

Code distance

To clearly understand the data validation, then the concept of spacing is still needed to understand.

The number of bits of two code words with different values is called the Hamming distance of the two code words. In a valid coding set, the minimum hemming distance of any two code words is called the Hemming distance of the coding set.

For example, if the first, fourth, and fifth digits of 10101 and 00110 are different, the haiming distance is 3.

A 1-bit error cannot be recognized when the code spacing is 1. Because any kind of error is valid code.

The origin of code distance and error correction ability

  • Code spacing ≥ E + 1, e errors can be detected
  • Code spacing ≥ 2 t + 1 can correct T errors
  • Code spacing ≥ E + T + 1 can correct T errors and detect E errors at the same time

It can be clearly known from the formula that the larger the code distance, the stronger the anti-interference ability, the stronger the error correction ability.

However, the problems brought by it also need to be considered, such as large data redundancy, low coding efficiency, complex circuit and so on.

parity

Parity check is divided into parity check and parity check.

Parity check is a method of verifying the correctness of code transmission based on whether the number of 1’s in the transmitted binary is odd or even. The ones that take an odd number are called odd check, and the ones that take an odd number are called even check.

The kind of check to be used is predetermined

A parity bit is usually added.

Odd parity

After the check bit is added, the number of 1s in the data is odd.

Odd check formula

calculation

An even number of ones, xor, must be zero, and an odd number of ones must be one. And 0 is going to be 0 whether there are even numbers or odd numbers.

Odd check error code

Parity checking

After the check bit is added, the number of 1s in the data is even.

The formula for even check

Error code for parity check

Parity detection cannot locate errors. No ability to correct errors.

Two-way parity check

Bidirectional parity check, also known as square check or vertical horizontal check.

Two-way means matrix transmission, with check bits in both directions. This increases the power of verification.

Thank you

Universal network

As well as hard-working self, personal blog, GitHub test, GitHub

Public number – return child mo, small procedure – small return blog

If you feel helpful to you, might as well give me a thumbs up 👍, continue to pay attention to ha!