Module - IV
Module - IV
Cryptographic Hash
Functions
User Device
H
4
H(P)
=?
Decision
Other Hash Function Uses
Message size < 264 < 264 < 264 < 2128 < 2128
Block size 512 512 512 1024 1024
Word size 32 32 32 64 64
Number of
steps 80 64 64 80 80
SHA-512
12.18
SHA-512
SHA-512 insists that the length of the original message be
less than 2128 bits.
Note
SHA-512 creates a 512-bit message digest out of a
message less than 2128.
SHA-512
SHA-512
Solution
We can calculate the number of padding bits as follows:
The values are calculated from first eight prime numbers 2, 3, 5, 7, 11, 13, 17, 19
Square root of all Prime numbers.
Convert the result into binary and keep only first 64 bits
64 binary bits convert into Hex.
Wi = W i-16
Compression function in SHA-512
SHA-512
Structure of each round in SHA-512 SHA-512
SHA-512
Majority Function
Conditional Function
Rotate Functions
SHA-512
SHA-512
There are 80 constants, K0 to K79, each of 64 bits. Similar
These values are calculated from the first 80 prime
numbers (2, 3,…, 409). For example, the 80th prime is
409, with the cubic root (409)1/3 = 7.42291412044.
Converting this number to binary with only 64 bits in the
fraction part, we get
• Authentication Requirements
• Authentication Functions
• Message Authentication Codes
• Security of Hash Functions and
MACs
Authentication Requirements
• Message authentication
– A procedure to verify that messages come from
the alleged source and have not been altered
– Message authentication may also verify
sequencing and timeliness
• Digital signature
– An authentication technique that also includes
measures to counter repudiation by either
source or destination
Authentication Functions
• Three classes of functions that may be used to
produce an authenticator
– Message encryption
• Ciphertext itself serves as authenticator
– Message authentication code (MAC)
• A public function of the message and a secret
key that produces a fixed-length value that
serves as the authenticator
– Hash function
• A public function that maps a message of any
length into a fixed-length hash value, which
serves as the authenticator
Message Encryption
• Conventional encryption can serve as
authenticator
– Conventional encryption provides authentication
as well as confidentiality
– Requires recognizable plaintext or other structure
to distinguish between well-formed legitimate
plaintext and meaningless random bits
• e.g., ASCII text, an appended checksum, or use of
layered protocols
Basic Uses of Message
Encryption
Internal & External Error Control
• Append an error-detecting code (frame check
sequence (FCS)) to each message
TCP Segment
• Suppose all the datagrams except the IP header is
encrypted.
• If an opponent substituted some arbitrary bit pattern for
the encrypted TCP segment, the resulting plaintext
would not include a meaningful header
41
Symmetric Message Encryption
• Encryption can also provides authentication
• If symmetric encryption is used then:
– Receiver know sender must have created it
– Since only sender and receiver now key used
– If message has suitable structure, redundancy or a checksum to
detect any changes
Asymmetric Message Encryption
• If public-key encryption is used:
• Anyone potentially knows public-key
However if
• Sender signs message using their private-key
• Then encrypts with recipient's public key
• Have both secrecy and authentication
– Again need to recognize corrupted messages
– But at cost of two public-key uses on message
Message Authentication Code
• Uses a shared secret key to generate a fixed-size
block of data (known as a cryptographic checksum
or MAC) that is appended to the message
• MAC = CK(M)
• Assurances:
– Message has not been altered
– Message is from alleged sender
– Message sequence is unaltered (requires internal
sequencing)
• Similar to encryption but MAC algorithm needs not
be reversible
Basic Uses of MAC
Why Use MACs?
– i.e., why not just use encryption?
• Cleartext stays clear
• MAC might be cheaper
• Broadcast
• Authentication of executable codes
• Architectural flexibility
• Separation of authentication check from
message use
Requirements for MACs