Hash Algorithms - A Detailed Study PDF
Document Details
Uploaded by OutstandingDialect
Nirma University
Parth Prajapati
Tags
Summary
This document provides a comprehensive overview of hash algorithms, their principles, and applications in security. It covers the evolution and various types of hash algorithms, and their crucial role in data integrity, authentication, password storage, digital signatures, and blockchain technology. The document also delves into real-world implementation of hash algorithms and their limitations.
Full Transcript
HASH ALORITHMS Hardware Security Special Assignment Parth Prajapati 24MRE011 OUTLINE The Evolution of Hash Algorithms Introduction Purpose and Importance Essential Characteristics Commonly Used Hash Algorithms Demonstration The Hashing Process Understan...
HASH ALORITHMS Hardware Security Special Assignment Parth Prajapati 24MRE011 OUTLINE The Evolution of Hash Algorithms Introduction Purpose and Importance Essential Characteristics Commonly Used Hash Algorithms Demonstration The Hashing Process Understanding SHA-2 Comparison of Hash Algorithms Security Risks and Limitation Future of Hash Algorithms Conclusion References The Evolution of Hash Algorithms 1976: Concept introduced by Ralph Merkle. 1978: MD (Message Digest) series begins (MD2, MD4, MD5). 1993: NIST (National Institute of Standards and Technology) introduce SHA (Secure Hash Algorithm). 2001: Release of SHA-2 with improved security. 2015: SHA-3 becomes the new standards. Present Day: Continued advancements , with new algorithms like BLAKE2 and research on quantum- resistant hashing. Introduction Definition: A hash algorithm is a function that takes an input (or message) and returns a fixed-length string of characters, which is typically a hash value. The process is one-way, meaning the hash value cannot be converted back into the original data. Hash ensures data integrity and is widely used in cryptography. Purpose and Importance Verify Data Integrity: Ensure files haven’t been tampered with during transfer. Password Security: Protect stored passwords in databases by hashing them. Digital Signatures: Authenticate the origin of messages/documents. Fast Data Lookup: Hashing is used in data structures like hash tables. Blockchain: Ensures the integrity of blockchain transactions. Essential Characteristics 1. Deterministic: Same input always produces the same output. 2. Fast Computation: Efficiently generates hashes. 3. Pre-Image Resistance: Impossible to reduce the input from the hash. 4. Avalanche Effect: A slight change in input results in a completely different hash. 5. Collision Resistance: Two different inputs should never produce the same hash. Commonly Used Hash Algorithms MD (Message Digest): Includes MD2, MD4, and MD5 (now insecure). SHA Family: SHA-1: Outdated and vulnerable. SHA-2: Secure, used in digital signatures and encryption. SHA-3: The most secure and modern version. BLAKE2: Faster than SHA and optimized for software/hardware. Understanding of Hash Algorithm Hash Algorithm Hash Algorithm Very easy to More secure than Hashing will gather plaintext. not reveal information. Decryption key is passwords in No security, can stored on servers, a data breach be reused with so it’s still No encryption other websites. vulnerable. key needed Website owner Once decryption key Website can also is hacked, all the owners can’t personal data. encrypted password read the Real-World Implementation When a new user signs-up, the new password is passed through the hash function and the digest is stored on the server. Hash Stored on server Real-World Implementation When the same user tries to log-in, the password they input is passed through the function again and the digest is compared to the one stored on the servers. Password Input Password1 23 Hash Function MD5/ SHA1 Re-calculated Digest D3%f@g4 3*I Real-World Implementation If the re-calculated hash matches the hash stored on the servers during initial sign-up, the log-in is allowed D3%f@g43 D3%f@g4 *I Re-calculated 3*I Hash Stored on the Digest Server Login is Allowed Hash Collision Salting Salting is the process of adding a random keyword to the end of the input. The random keyword added is called the salt/salt value The salt is unique for each for each user in the database and is helpful to battle hash collision. Input into Hash Function MD5 Hash Value/Digest Cryptography 22ddec1169e3bc1f115a3c44b61 8f844 Cryptographyabc123 273782601363ce5bb50ba43746 ce9a8c Cryptographyxyz456 fe7b6730c73d5d2a9e342bc321 6077cb Hash Collision Peppering Peppering is the process of adding the same random value at the end of a plain text. Since it doesn’t change per user, the random value need not be stored on server. In the case of a data breach pepper value is safe from further exploitation. Input into Hash Function MD5 Hash Value/Digest Cryptography 22ddec1169e3bc1f115a3c44b61 8f844 CryptographyPar123 de16fa0ee5e904819f394d5a161 55441 PasswordPar123 b7ab8f085b7d49ac8d197b811d e6dc00 MD5 Hash Algorithm It’s a one-way cryptographic hash function. MD5 has 128-bit digest size for every single input. The MD5 is initially designed for digital signatures. MD5 is designed by Ronald Rivest in 1991. MD5 Hash Algorithm Step1: Padding Bits / Adding the Extra bits Firstly, make plaintext compatible with the hash function. Total bit must always be 64 bits short of any multiple of 512. The first bit added is ‘1’, and the rest are all zeroes. Original Message Padding Bits Total length to be 64 bits less than multiple of 512 MD5 Hash Algorithm Step 2: Padding Length Length of the original message is padded to the result from Step1. Length is expressed in the from of 64 bits. Resultant string will now be a multiple of 512. Used to increase complexity of the function. Original Message Padding Bits Length of Input Final Data to be Hashed as a multiple of 512 MD5 Hash Algorithm Step 3: Initialize MD Buffer The entire message is broken down into block of 512 bits each. 4 buffers are used of 32 bits each. They are 4 words named A,B, C and D. The first iteration has fixed hexadecimal values. A = 01 23 45 B = 89 ab cd 67 ef C = fe dc ba D = 76 54 32 98 10 MD5 Hash Algorithm Step 4: Process Each Block Each block is broken don to 16 sub blocks of 32 bit each. There are 4 rounds of operations, each of them utilizing all 16 sub blocks, the 4 buffers and others constants. The constant value is an array of 64 elements, with 16 elements being used every round. Sub block : M, M, … M. Constant array : T, T, …. T. A B C D Non-Linear Process Addition M[j] Addition Addition Addition Shifting Addition A B C D MD5 Hash Algorithm Non-Linear Process Function Which is different for each round. Used to increase randomness of the hash as an upgrade over MD4. Round 1: (b AND c) OR ((NOT b) AND (d)) Round 2: (b AND d) OR (c AND (NOT d)) Round 3: b XOR c XOR d Round 4: c XOR (b or (NOT d)) Secure Hash Algorithm NAS & NIST joint development. SHA has multiple families such as SHA -0,1,2 & 3. Declared FIPS in 1993. Characteristics Length of the original message should be less than 2^64 bits. The length of digest is always 160 bits in length. Digest should not be produce the original message Secure Hash Algorithm Step 3: Initialize Chaining Variables. The entire message is broken down into blocks of 512 bits each. 5 buffers are used of 32 bits each. They are 5 words named A, B, C, D and E. The first iteration has fixed hexadecimal values. A = 01 23 45 B = 89 ab cd C = fe dc ba 67 ef 98 D = 76 54 32 E = C3 D2 E1 10 FO Secure Hash Algorithm Step 4: Process Each Block Each 512 bit block is broken down to 16 sub blocks of 32 bit each. There are 4 rounds of operations, each of them utilizing the abcde register, the 512 bit block and a constant K[t]. Each round has 20 iterations, so total iteration = 4x20 = 80 rounds. The constant value is an array of 80 elements, with 16 Round elements being no. every round. used Value of T 1 1-19 2 20-39 3 40-59 4 60-79 Secure Hash Algorithm Each iteration follows a formula : ABCDE = E + Process P + S5(A) + W(t) + K(t). ABCDE = Register value of the chaining variables. P = Logical Process that changes each round. S5 = Circular shift by 5 bits. W(t) = A 32-bit string derived from existing sub block K(t) = One of the constants which changes each round. For the words from 0-16 (W(0-15)), the sub block M(t) is same as w(t). The remaining 64 values are calculated as : W[t] = S1( W(t-16) XOR W(t-14) XOR W(t-8) XOR W(t-3)). A B C D E Process P Addition S5 Addition Addition W[t] Addition K[t] A B C D E Comparison of Hash Algorithms Algorithm Strengths Weakness MD5 Fast Vulnerable to collision SHA-1 Moderate Security Considered insecure now. SHA-2 Highly secure Slower than MD5 SHA-3 Future-proof Less widely adopted yet. Security Risks and Limitation Collision Attacks: Finding two inputs that produce the same hash. Rainbow Table Attacks: Precomputed tables of hashes used to reverse weak hashes. Computational Cost: Stronger hashes like SHA-3 require significant processing power. Obsolescence: Older algorithms become insecure as computational power increases. Future of Hash Algorithms The evolution of cryptographic hash functions focuses on addressing emerging challenges, including quantum computing threats and the need for faster, lightweight algorithms. Post-Quantum Cryptography: Designing hash functions resistant to quantum computing. Optimized Algorithms: For IoT and edge devices with low power consumption. Standardization: SHA-3 adoption in various industries. Conclusion Hash algorithms are crucial in cryptography. They ensure data integrity, authentication, and security. These algorithms are used in applications like password storage, digital signatures, and blockchain. As technology advances, future hash algorithms must address challenges like quantum computing and lightweight security for IoT devices. "Hash algorithms will keep evolving, remaining vital in securing our digital world." References