Before the identity authentication and data encryption and decryption, identity authentication can ensure that the data source is not a problem, data encryption and decryption can ensure that the data is intercepted by eavesdroppers can also prevent eavesdroppers to know the content of the data, to achieve the safe transmission of data, but also to determine the data received without eavesdropping tampering, which involves data integrity check.
Hash
A hash is an irreversible mapping that computes a hash of the data, and can no longer reflect the original data by the hash value. In general, different data get the hash value is different, but there is very little likelihood of collisions, this minimal probability is not considered here.
The hashing algorithms used in network data integrity checks typically include: MD5, SHA.
Data Integrity Check
Data integrity checks generally use a hashing algorithm and a key to hash the data to get a hash of the data, and then send the hash value and data piece to each other, after the other party receives the data, the data using the same hash algorithm and key hash to get the hash value, if the resulting hash value and the other sent over the same, Then it means that the data has not been tampered with.
One might think that the commonly used hashing algorithm in a few categories, assuming that the eavesdroppers intercepted the data, modify some of the data area of the byte, and then use the hash algorithm again hash to get a new hash value, put in the packet, the location of the SID value is passed to the receiver, the receiver receives, the data is hashed, The resulting hash value is the one that the eavesdroppers sent over. Thus the eavesdroppers realized the purpose of destroying the information, although not acquiring information. This is why you need to use a key when hashing : After the two sides of the communication are authenticated, the key is exchanged, including the symmetric cryptographic key, the hash algorithm's key, and other .... The hash key is used at the time of the hash, and the eavesdroppers does not have a hash key, so his last forged hash value cannot be verified.
Network Security (3): Data integrity check