03 Modification Check Values Flashcards
(41 cards)
What are the two main categories of modification check values?
- MDC (Modification Detection Code)
- MAC (Message Authentication Code)
What is a Hash function and what are their two main properties?
A hash function is a function “h” with the properties of:
- Compression: h maps an input x of arbitrary finite bit length, to an output h(x) of fixed bit length n.
- Ease of computation: (with h and x it is easy to compute h(x)).
Cryptographic hash functions are used to compute MDC (Modification Detection Codes).
What are other (secondary) properties of cryptographic hash functions?
- Pre-image resistance (for all pre-specified outputs y, it is computationally infeasible to find and x that h(x)=y). –> Non-reversible.
- 2nd pre-image resistance (given x it is computationally infeasible to find any second input x’ with x=/=x’ such that h(x)=h(x’) )–> Different results for every hash.
- Collision resistance: it is computationally infeasible to find any pair (x,x’) with x=/= x’ such that h(x)=h(x’) –> Cannot find two different arbitrary inputs that produce the same output/hash.
What is a MAC and how it works?
MAC (Message Authentication Code) is a family of functions hk parameterized by a secret key k with properties:
- Compression: hk maps an input x of arbitrary finite bit-length to an output hk(x) of fixed bit-lenght, called the MAC.
- Ease of computation: given k, x and a known function family hk the value hk(x) is easy to compute.
- Computation-resistance: for every fixed, allowed, but unknown value of k, given zero or more text-MAC pairs (xi, hi(xi)) it is computationally infeasible to compute a text-MAC pair (x, hk(x)) for any NEW input x=/= xi.
What is computation-resistance on MACs?
Implies a property where k cannot be recovered using pairs (xi, hk(xi)).
However, computation-resistance is not deduced solely from key non-recovery as sometimes the key k is not needed to forge new MACs.
Message integrity is the principal application which lead the original design of MDC and MAC. Elaborate on each of them:
- MDC (Modification Detection Code) -> represents a digital fingerprint, that can be signed with a private key (RSA, ElGamal…) and two messages cannot have the same fingerprint (non-reusable by attackers).
- MAC (Message Authentication Code) -> over a message m, certifies that a sender of the message possesses the secret key K and the message could not have been modified without that key.
What are other (non-original) applications for MDC and MAC that require some caution:
- Confirmation of knowledge
- Key derivation
- Pseudo-random number generation
What is the Birthday Phenomenon and how is it related to MDCs?
- Concerns the probability that, in a set of n randomly chosen people, some pair of them will have the same birthday.
- p.50% = 23 people
- p.99% = 70 people
- If there are n possible different values, the number K of values needed to obtain at least one pair of identical values is of the order: k = 1.18*Sqrt(n)
- This is related to MDCs due to the birthday attack because this one depends on the higher likelihood of collisions (different inputs, same hash output) found between random attack attempts and a fixed degree of permutations.
- Due to this birthday problem, these attacks are much faster than a brute force attack.
What are some challenges faced by the Birthday attack?
- At least 1.18*Sqrt(n) variations of each of the two messages must be produced in order to have at least a probability of 0.5
- A memory problem (storing every message tried with their MDCs to find a match)
- m1’ and m2’ should produce MDC1(m1’) = MDC1(m2’)
- Average effort to produce two m1’ and m2’ are of the order n^(MDCs lenght/2)
- Thus a minimum of 160 bitlength of the hash value is recommended as it is considered as infeasible to attack.
Explain the Merkle-Dåmgard structure in used by many cryptographic hash functions today:
- An arbitrary message (y) has its length appended and it is padded/splitted into block sizes b (Creating y0, y1,.. yL-1. L blocks of size b)
- An IV is assigned to CV0 (Chaining Value) := IV and then MDC(y) := CVL
- f is a compression function wich compresses (n+b) bits to n bits (shifted b comming from the current y) and n comming from the current CV)
Summarized:
CV0 = IV initial n-bit value
CVi = f (CVi-1, yi-1) 1 <= i <= L
H(y) = CVL

Explain the Merkle-Dåmgard structure, a common structure of Cryptographic Hash Functions:

Mention some inherent weaknesses of Merkle-Dåmgard constructions:
- If one collision is found, finding more is cheap.
- Multi-collisions can be found with little more work than collisions.
- Second preimage attacks are much more efficient than brute force
What are some Cryptographic Hash Functions commonly used for creating MDCs?
- MD5 = Message Digest 5
- SHA1 = Secure Hash Algorithm 1
- SHA2 = Secure Hash Algorithm 2 (SHA-256, SHA-512)
- SHA3 = Secure Hash Algorithm 3
Explain and elaborate on MD5:
- MD5 processes a variable-lenght message into a fixed-length output of 128 bits.
- A message “y” is padded by a “1” followed by 0-to-511 “0”s bits such that the length of the resulting message is congruent 448 modulo 512 (divisible by 512).
- Length of the message is up to 64 bits fewer than 512 (=448).
- The message is divided in blocks of b=512 bits.
- MD5 operates on a n=128-bit state (chaining value acts as four 32-bit words A,B,C and D).
- Each block of the message (yi) is processed with the chaining value CVi with the function f (internally realized by 4 rounds of 16 steps each = 64 operations in total). This modifies the chain state.
- The processing of a message block uses a non-linear function F (4 differents), modular addition (with the aid of a table T with 64 constants) and left shift by s-bits.

Graphically explain 1 step of MD5:

Explain some security concerns about MD5:
- In 1996 an attack that allows a collision (same hash for different inputs) for the function f was published.
- In 2004 the first collision was found.
- Currently a collision can be done with the right hardware within seconds.
- MD5 for collision resistance compliance must be avoided (different files, same MD5, faking signatures such SSL certificates)
- MD5 is still OK against preimage attacks (good for tranmissions checking or data consistency).
- It is recommended to use another higher-output hash function like SHA-256.
Explain and elaborate on DES-CBC-MAC:
- DES-CBC-MAC is also called CBC-MAC, uses the Data Encryption Standard in Cipher Block Chaining Mode.
- Constructs a MAC from a block cipher with IV=0
- This chain of blocks ensures that the final encrypted block is changed if any plaintextbits were altered.
Explain and elaborate on SHA1:
- SHA-1 (Secure Hash Algorithm) works on 512-bit blocks and produces a 160-bit hash
- Inspired by MD4, so, its initialization is basically the same as that one of MD5 (padding data, lenght field added and the message is a multiple of 512 bits)
- The CV (chaining value) is structured in 5 32-bit registers: A, B, C, D, E (using big-endian format)
- Each block yi of the message is processed with CVi in a module with a compresion function “f” in four rounds of 20 steps each. Each round uses a different function (f1, f2, f3, f4).
- Each step makes use of a fixed additive constant Kt unchanged per round.
- A left-bit rotation of n places is carried out.
- The SHA-1 MDC over a message is the content of the chaining value (CV) after processing the final message block.

How does SHA-1 and MD5 compare?
- As SHA-1 design was inspired by MD4, its initialization is basically the same as MD5.
- Speed: SHA-1 is 25% slower than MD5 (CV is about 25% bigger).
- BOTH: simplicity and compactness, both algorithms are simple to describe and implement and do not require large programs or substitution tables.
Elaborate on security aspects of SHA-1:
- SHA-1 operates on a length of 160 bits, where MD5 does it on 128 bits. Therefore it is expected that SHA-1 offers better security against brute-force and birthday attacks than MD5.
- In 2005 an attack that allows to find therotical collisions was published and latter improved, however, no practical collisions are publicly known yet.
- Inherent waknesses of Merkle-Dåmgard constructions apply.
Graphically explain one step of SHA-1:

Elaborate on the security discussion of SHA-2:
- In 2004 a simplified version of the algorithm (with XORs instead of addition and symmetric constants) generated highly correlated output.
- For round-reduced versions (57/80 for SHA-512 and 52/64 for SHA-256) pre-image attack exists that are faster than brute-force but are highly impractical.
- It’s size and complexitly does not allow attacks but the situation is turning uncomfortable -> Led to the need of SHA-3.
Explain and elaborate on SHA-2:
- SHA-2 was published in 2001 by the NIST as new variants such as SHA-256 and SHA-512. There are truncated versions like SHA-224 and SHA-384.
- SHA-2 also uses a Merkle-Dåmgard construction with a block size of 512 bits (SHA-256) and 1024 bits (SHA-512).
- The internal state is organized in 8 registers (A, B, C… H) of 32 bits for SHA-256 and 64 bits for SHA-512.
- SHA-256 has 64 rounds and SHA-512 has 80 rounds.
- Design very similar to SHA-1, although the attacks of SHA-1 don’t apply to it.
- Usage of Kt as the fractional part of the cube root of the tth prime number.
- ROTR and σ functions that XOR different shifts of input values.
- “Ch” and “Maj” as logic combinations of input values.
- 30 to 50% slower than SHA-1 due to size and more complicated round functions (varying in 32 and 64 bit systems).

Graphically explain one step of SHA-2:





