0% found this document useful (0 votes)
25 views37 pages

Cs PPT CHP 3 Part 4

Uploaded by

SAKSHI SHINDE
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views37 pages

Cs PPT CHP 3 Part 4

Uploaded by

SAKSHI SHINDE
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 37

CHAP III PART IV

By: Ms. Khushboo S.Sathawane


Lecturer in Computer Engineering
Department Government
Polytechnic,Pune
BASIC HASH FUNCTION DIAGRAM
EXAMPLE
 We’re sending a file to our friend. It’s a really
important file and we want to ensure it has been
received in one piece. That’s when our hashing
algorithm comes in. But first, let’s think how our file
transfer would look without it:
EXAMPLE CONTD….
 We can figure out some trivial ideas. You could, for
instance, call the User2 and you could check the file
content together. But then what’s the point in sending a
file?
 Before sending a file, User1 uses a hashing algorithm to
generate a checksum for a file.
 Then he/she sends it alongside the file itself. User2
receives both the file and the checksum.
 Now he/she can use the same hashing algorithm on the
received file.
 What’s the point? We already know that a hash is
individual (so there can’t be any other file with the same
hash) and has to be always the same for an individual file.
HASHING-WORKING
 When a user sends a secure message, a hash of the
intended message is generated and encrypted, and is
sent along with the message.
 When the message is received, the receiver decrypts
the hash as well as the message.
 Then, the receiver creates another hash from the
message.
 If the two hashes are identical when compared, then a
secure transmission has occurred.
 This hashing process ensures that the message is not
altered by an unauthorized end user.
 Hashing is used to index and retrieve items in a
database because it is easier to find the item using the
shortened hashed key than using the original value.
WHAT WE USE IT FOR?
 Cryptographic hash functions are used notably
in IT.
 We can use them for digital signatures,
message authentication codes (MACs), and
other forms of authentication.
 We can also use them for indexing data in hash
tables, for fingerprinting, identifying files,
detecting duplicates or as checksums (we can
detect if a sent file didn’t suffer data
corruption).
 We’ll show you an example of the last feature.
HASH ALGORITHM
 A hash algorithm is a one way function that converts a
data string into a numeric string output of fixed length.
The output string is generally much smaller than the
original data.
 Therefore it is also called message digest or message
compression algorithm.
  Hash algorithms are designed to be collision-resistant,
meaning that there is a very low probability that the
same string would be created for different data.
  Two of the most common hash algorithms are the MD5
(Message-Digest algorithm 5) and the SHA-1 (Secure
Hash Algorithm). MD5 Message Digest checksums are
commonly used to validate data integrity when digital
files are transferred or stored.
HASHING ALGORITHMS
 MD-5
 SHA
MD5 ALGORITHM STRUCTURE
MD5 STEPS
 The following five steps are performed to
compute the message digest of the message.
 Step 1. Append Padding Bits
 Step 2. Append Length
 Step 3. Initialize MD Buffer
 Step 4. Process Message in 16-Word Blocks
 Step 5. Output
IMPLEMENTATION STEPS
 Step1 Append padding bits
 The input message is "padded" (extended) so that
its length (in bits) equals to 448 mod 512.
Padding is always performed, even if the length
of the message is already 448 mod 512.
Padding is performed as follows: a single "1"
bit is appended to the message, and then
"0" bits are appended so that the length in
bits of the padded message becomes
congruent to 448 mod 512.
STEP 1
IMPLEMENTATION STEPS
 Step2. Append length
A 64-bit representation of the length of
the message is appended to the result of
step1.
 The resulting message (after padding with
bits and with length) has a length that is
an exact multiple of 512 bits. The input
message will have a length that is an
exact multiple of 16 (32-bit) words.
STEP 2
IMPLEMENTATION STEPS
 Step3. Initialize MD buffer
A four-word buffer (A, B, C, D) is used to compute
the message digest. Each of A, B, C, D is a 32-bit
register. These registers are initialized to the
following values in hexadecimal, low-order bytes
first):

word A: 01 23 45 67
word B: word D: 76 54 32 10 89 ab cd ef
word C: fe dc ba 98
STEP 3
IMPLEMENTATION STEPS
 The main MD5 algorithm operates on a 128-bit state,
divided into four 32-bit words, denoted A, B, C,
and D.
 These are initialized to certain fixed constants. The
main algorithm then uses each 512-bit message block
in turn to modify the state.
 The processing of a message block consists of four
similar stages, termed rounds; each round is
composed of 16 similar operations based on a non-
linear function F, modular addition, and left
rotation.
 Figure 1 illustrates one operation within a round.
There are four possible functions; a different one is
used in each round:
IMPLEMENTATION STEPS
 Step4. Process message in 16-word blocks
Four functions will be defined such that each
function takes an input of three 32-bit words and
produces a 32-bit word output.
ONE MD5 OPERATION.
MD5 CONSISTS OF 64
OF THESE OPERATIONS,
GROUPED IN FOUR
ROUNDS OF 16
OPERATIONS. F IS A
NONLINEAR FUNCTION;
ONE FUNCTION IS USED
IN EACH
ROUND. MI DENOTES A
32-BIT BLOCK OF THE
MESSAGE INPUT,
AND KI DENOTES A 32-
BIT CONSTANT,
DIFFERENT FOR EACH
OPERATION. S DENOTES
A LEFT BIT ROTATION
BY S PLACES; S VARIES
FOR EACH
OPERATION. DENOTES
ADDITION MODULO 232.
STEP 5. OUTPUT
 The message digest produced as output is A,
B, C, D.
 That is, we begin with the low-order byte of
A, and end with the high-order byte of D.
MD5 HASHES
 The 128-bit (16-byte) MD5 hashes (also
termed message digests) are typically
represented as a sequence of 32 hexadecimal
digits. The following demonstrates a 43-byte
ASCII input and the corresponding MD5 hash:
SECURITY
 The security of the MD5 hash function is
severely compromised. A collision attack
exists that can find collisions within seconds
on a computer with a 2.6 GHz Pentium 4
processor.
 As it is easy to generate MD5 collisions, it is
possible for the person who created the file
to create a second file with the same
checksum, so this technique cannot protect
against some forms of malicious tampering.
APPLICATIONS

 MD5 digests have been widely used in the


software world to provide some assurance that a
transferred file has arrived intact. For example,
file servers often provide a pre-computed MD5
(known as md5sum) checksum for the files, so
that a user can compare the checksum of the
downloaded file to it.
 Most unix-based operating systems include MD5
sum utilities in their distribution packages;
 Windows users may use the included PowerShell
function "Get-FileHash", install a Microsoft
utility,or use third-party applications.
 Android ROMs also use this type of checksum.
SHA(SECURE HASH ALGORITHM)
 Family of SHA comprise of four SHA algorithms; SHA-0, SHA-1,
SHA-2, and SHA-3. Though from same family, there are
structurally different.
 The original version is SHA-0, a 160-bit hash function, was
published by the National Institute of Standards and Technology
(NIST) in 1993.
 It had few weaknesses and did not become very popular. Later
in 1995, SHA-1 was designed to correct alleged weaknesses of
SHA-0.
 SHA-1 is the most widely used of the existing SHA hash
functions. It is employed in several widely used applications
and protocols including Secure Socket Layer (SSL) security.
 SHA-2 family has four further SHA variants, SHA-224, SHA-256,
SHA-384, and SHA-512 depending up on number of bits in their
hash value.
 In October 2012, the NIST chose the Keccak algorithm as the
new SHA-3 standard. Keccak offers many benefits, such as
efficient performance and good resistance for attacks.
SHA-1
SHA-1

You might also like