Unit 4
Unit 4
1.Select K.
If K < b, pad 0’s on left until k=b. K is between 0 and b ( 0 < K < b )
2.EXOR K+ with ipad equivalent to b bits producing S1 bits.
3.Append S1 with plain text M
4.Apply SHA-512 on ( S1 || M )
5.Pad n-bits until length is equal to b-bits
6.EXOR K+ with opad equivalent to b bits producing S2 bits.
7.Append S2 with output of step 5.
8.Apply SHA-512 on step 7 to output n-bit hashcode.
HMAC (MAC BASED ON HASH FUNCTION)
Advantages
• HMACs are ideal for high-performance systems like routers due to the use
of hash functions which are calculated and verified quickly unlike the
public key systems.
• Digital signatures are larger than HMACs, yet the HMACs provide
comparably higher security.
• HMACs are used in administrations where public key systems are
prohibited.
Disadvantages
• HMACs uses shared key which may lead to non-repudiation. If either
sender or receiver’s key is compromised then it will be easy for attackers
to create unauthorized messages.
DIGITAL SIGNATURE
1.Key Generation Algorithms: Digital signature is electronic signatures, which assure that the
message was sent by a particular sender. While performing digital transactions authenticity and
integrity should be assured, otherwise, the data can be altered or someone can also act as if he was
the sender and expect a reply.
2.Signing Algorithms: To create a digital signature, signing algorithms like email programs create a
one-way hash of the electronic data which is to be signed. The signing algorithm then encrypts the
hash value using the private key (signature key). This encrypted hash along with other information
like the hashing algorithm is the digital signature. This digital signature is appended with the data
and sent to the verifier. The reason for encrypting the hash instead of the entire message or
document is that a hash function converts any arbitrary input into a much shorter fixed-length value.
This saves time as now instead of signing a long message a shorter hash value has to be signed and
moreover hashing is much faster than signing.
3.Signature Verification Algorithms : Verifier receives Digital Signature along with the data. It then
uses Verification algorithm to process on the digital signature and the public key (verification key)
and generates some value. It also applies the same hash function on the received data and
generates a hash value. If they both are equal, then the digital signature is valid else it is invalid.