Introduction
One of the primary goals of information security is to provide assurance about the origin of a received message. But who is responsible for disrupting the originality of the received messages? Hackers/Attackers.
Types of Attacks
There are two types of attacks: Passive and Active attacks. The difference between them is very important to know for today’s discussion.
Passive Attacks
The passive attack is the initial sort of attack. For specific functions, a passive attack can monitor, observe, or develop the use of the system's data. However, it does not affect the system's resources, and the data remains unaffected. Because passive attacks are carried out in stealth, it is difficult for the victim to notice them. The goal of a passive attack is to get data or to search the network for open ports and vulnerabilities.
Active Attacks
An active attack might be a network exploit in which the attackers modify or alter the content and cause a system resource to be impacted. The victims will suffer harm as a result of it. The attackers might use passive attacks to gather information before launching a more aggressive strike. The attackers try to break into the system and cause it to lock. The victims can be alerted about the ongoing attack. Their integrity and accessibility may be jeopardized due to such an attack. A forceful attack is more challenging to execute than a quiet attack.
Using the above statements, passive attacks are less harmful than active attacks since the message is altered. The methods we discussed in the previous articles are only suitable for confidentiality or secrecy by encrypting messages using a suitable crypto mechanism.
This is sufficient to protect against a passive adversary who only observes messages sent between Ninja A and Ninja B. However, there are numerous other threats that we must address. One natural scenario is when there is an active adversary who has the ability to alter the content of messages.
Let us understand with an example:
An adversary can change the ciphertext sent from Ninja A to Ninja B. A simple toggle operation would allow the adversary to convert 1s to 0s and vice versa.

The bit-flipping attack described here complements the same bits of the plaintext in exactly the same way. The adversary can alter the plaintext in a predictable manner even though he is unaware of what it is.
We may not be able to prevent the adversary from modifying messages, but appropriate cryptographic tools will allow us to detect when a modification has occurred.
So, we aim to identify changes to transmitted messages, whether encrypted or not. This objective—often referred to as Data origin authentication—is a more robust version of another cryptographic objective, data integrity.
Data origin authentication
Data origin authentication ensures the sender's identity as well as data integrity. Another point of view is that data origin authentication implicitly provides data integrity because if the message is changed, the message's source has changed. Non-repudiation is another security goal related to data origin authentication because it prevents the original sender of a specific message from denying his/her action to a third party.
Now, how to achieve this is a question.
So, data integrity can be guaranteed by a cryptographic hash function.
Let us understand it: