Week 12 Digital Signatures and Hash Functions
Week 12 Digital Signatures and Hash Functions
In Week 12, the focus is on digital signatures and hash functions, two critical elements of
modern cryptography that play a fundamental role in ensuring the integrity, authenticity, and
security of communications and data in the digital world. This week covers:
A digital signature functions like a traditional handwritten signature but with the added
advantage of being more secure and harder to forge. It is based on asymmetric encryption,
which uses a pair of cryptographic keys: a private key (used for signing) and a public key
(used for verification).
• Signing Process:
1. A message or document is hashed using a cryptographic hash function,
producing a fixed-size message digest.
2. The message digest is then encrypted using the sender's private key, creating
the digital signature.
3. The digital signature, along with the original message or document, is sent to
the recipient.
• Verification Process:
1. The recipient uses the sender's public key to decrypt the digital signature and
retrieve the message digest.
2. The recipient also hashes the received message or document using the same
hash function.
3. If the decrypted message digest matches the newly computed digest, it confirms
that the message is authentic and has not been altered.
• Applications of Digital Signatures:
1. Email Verification: Digital signatures in email messages help verify the
sender's identity and ensure that the email content has not been tampered with.
2. Software Distribution: Digital signatures are used to authenticate software
packages, ensuring that they have not been altered or corrupted by malicious
actors.
3. Legal Documents: Many digital contracts and agreements are signed using
digital signatures to provide evidence of authenticity and consent.
• Benefits of Digital Signatures:
1. Authenticity: Ensures that the message or document originated from the
claimed sender.
2. Integrity: Verifies that the message or document has not been tampered with
during transmission.
3. Non-Repudiation: Prevents the sender from denying their involvement in the
transaction or message.
A hash function is a mathematical function that takes an input (or "message") and produces a
fixed-size output, known as a hash value or message digest. The output is typically a string of
characters that represents the input data. Hash functions are widely used in cryptography, data
integrity, and digital signatures.
• Deterministic: The same input will always produce the same hash output.
• Fixed-Length Output: Regardless of the size of the input, the output hash is always of
a fixed length.
• Efficient: The hash function should be fast to compute.
• Pre-image Resistance: Given a hash output, it should be computationally infeasible to
reverse-engineer the original input.
• Collision Resistance: It should be computationally infeasible to find two different
inputs that produce the same hash output.
• Avalanche Effect: A small change in the input should result in a drastically different
hash output.
• Data Integrity: By hashing data, you can verify its integrity. If the hash value matches
the expected value, it indicates the data has not been altered.
• Password Storage: Hashing is commonly used to store passwords securely. When a
user logs in, the system hashes the entered password and compares it to the stored hash
value.
• Digital Signatures: The use of a hash function is central to the creation of digital
signatures. The message digest created by hashing ensures that the signed message is
consistent and unmodified.
The MD5 algorithm was designed by Ronald Rivest in 1991 as a cryptographic hash function
that produces a 128-bit (16-byte) hash value, typically rendered as a 32-character hexadecimal
number.
• Strengths:
o MD5 is fast and efficient, making it useful in many applications, such as
checksums and file integrity verification.
• Weaknesses:
o Collision Vulnerability: MD5 is known to be vulnerable to collision attacks,
where two different inputs produce the same hash output. As computing power
increased, researchers discovered that it is possible to generate two different
inputs that produce the same MD5 hash.
o Due to these vulnerabilities, MD5 is no longer considered secure for
cryptographic purposes, such as digital signatures or certificate verification.
The SHA family of cryptographic hash functions is widely used in security applications.
Developed by the National Security Agency (NSA), it includes several versions, with SHA-1,
SHA-2, and SHA-3 being the most common.
• SHA-1: SHA-1 produces a 160-bit hash value (20 bytes). While once widely used in
digital signatures and certificates, SHA-1 has been found to be vulnerable to collision
attacks, and its use is no longer recommended for security-critical applications.
• SHA-2: SHA-2 is a family of hash functions that includes SHA-224, SHA-256, SHA-
384, and SHA-512, where the number refers to the length of the output hash (in bits).
SHA-256 and SHA-512 are widely used and considered secure for cryptographic
applications.
o SHA-256: Produces a 256-bit hash (32 bytes) and is used in various
applications, including blockchain technology (Bitcoin), digital certificates, and
SSL/TLS protocols.
o SHA-512: Produces a 512-bit hash (64 bytes) and is used in contexts that
require stronger security guarantees.
• SHA-3: SHA-3 is a newer family of hash functions, based on the Keccak algorithm. It
is designed to provide a higher level of security and resistance to attacks than SHA-2.
Cryptographic integrity ensures that data has not been altered during storage or transmission.
This is essential in many scenarios, such as:
• File Integrity Verification: By hashing files and storing the hash values, you can later
verify that the file has not been modified. For example, software updates or downloads
can be verified using hashes to ensure that the file hasn’t been tampered with by
malicious actors.
• Digital Transactions: Cryptographic integrity is crucial in financial transactions,
where data must be accurate and unmodified to prevent fraud and financial loss. Digital
signatures and message digests are used to ensure the authenticity of transaction
records.
• Password Protection: Hash functions are used to securely store passwords, ensuring
that even if a database is compromised, the actual password is not exposed. Hashing
ensures that password information is stored in a way that it cannot be easily reversed or
exploited.
3.2 Non-repudiation
Cryptographic integrity ensures non-repudiation, meaning that once data has been signed or
transmitted, the sender cannot deny having sent it. Digital signatures and message digests help
establish trust in transactions by ensuring that the data came from a legitimate source and has
not been modified since its transmission.
Conclusion
In Week 12, we explored the crucial concepts of digital signatures, hash functions, and
message digests. These cryptographic tools are fundamental to ensuring the authenticity,
integrity, and security of data in a wide range of digital applications. We also examined
common hashing algorithms such as MD5, SHA, and SHA-2, highlighting their strengths and
vulnerabilities. Finally, we emphasized the importance of cryptographic integrity in
maintaining security in digital communications, file integrity, and data protection.
Understanding these cryptographic mechanisms is essential for anyone working in
cybersecurity, as they form the backbone of securing digital information and ensuring trust in
online transactions.