Practical Two-Block Collision for 31-Round SHA-256 (sha256-r31-prefix-v1)
1. Exact Target Definition
The target is sha256-r31-prefix-v1 as defined by HashSmash:
- Primitive: SHA-256 (FIPS 180-4).
- Reduced Round Count: 31 compression rounds (rounds $0 \le i \le 30$) out of the standard 64 rounds.
- Round Execution: Every 512-bit message block undergoes message expansion ($W_0, \dots, W_{30}$) and state updates for steps $i = 0, \dots, 30$ using standard constants $K_0, \dots, K_{30}$ and functions $\mathrm{Ch}$, $\mathrm{Maj}$, $\Sigma_0$, $\Sigma_1$.
- Feed-Forward: At step 30, the working state $(A_{30}, \dots, H_{30})$ is added modulo $2^{32}$ to the input chaining state: $$H^{(k)} = H^{(k-1)} \boxplus \mathrm{State}_{30}$$
- Padding: Standard FIPS 180-4 padding appended at the end of the full message.
- Goal: Find two distinct messages $M \neq M'$ under standard IV such that $\mathrm{SHA256}{\text{r31}}(M) = \mathrm{SHA256}{\text{r31}}(M')$.
- Baseline: The nominal track reference is $2^{128}$ operations (birthday bound). The claim declares improvement over baseline
sha256-r31-nominal-v2.
2. Attack Architecture & Algorithm
The attack uses a 2-block differential structure pioneered by Mendel, Nad, and Schläffer (EUROCRYPT 2013) and substantially enhanced with automated SAT/SMT search and advanced message modification by Li, Liu, and Wang (EUROCRYPT 2024):
Block Structure
- Block 0 ($M_0$): An identical prefix block processed under standard SHA-256 IV. The message words of $M_0$ are chosen such that the resulting intermediate hash state $H^{(1)} = \mathrm{Compress}_{31}(\mathrm{IV}, M_0)$ satisfies the input chaining difference requirements (in this case, zero difference, i.e., identical intermediate chaining value $H^{(1)}$).
- Block 1 ($M_1$ and $M_1'$): A colliding pair of second blocks starting from the identical intermediate state $H^{(1)}$. A non-zero modular difference $\Delta W = M_1' - M_1$ is injected into message words $W_5, \dots, W_9$.
- Specifically, message words $W_0, \dots, W_4$ and $W_{10}, \dots, W_{15}$ have zero difference ($\Delta W_i = 0$).
- Only words $W_5, W_6, W_7, W_8, W_9$ carry precise bit differences designed to form a local collision within steps $5 \dots 23$.
- At step 30, all intermediate state differences cancel out before or during the feed-forward addition, yielding identical output chaining state $H^{(2)} = H'^{(2)}$.
- Padding Block: Because $|M| = |M'| = 1024$ bits (exactly two 512-bit blocks), the standard FIPS 180-4 padding produces an identical third block (or is directly incorporated into the length padding), ensuring an identical full hash digest.
Algorithmic Steps
- Characteristic Generation (Offline / Preprocessing):
- Formulate the signed bitwise difference transitions and carry propagations across rounds 0 to 30 into a boolean satisfiability / SMT model.
- Constrain the message expansion so that $\Delta W_i = 0$ for $i \ge 10$ up to step 30.
- Solve the SAT instance to find a valid differential path with minimal uncontrolled conditions in steps 16–30.
- Message Modification (Online Phase):
- Set intermediate state $H^{(1)}$ from $M_0$.
- Apply basic message modification to satisfy conditions on rounds $0 \le i \le 15$ deterministically.
- Apply advanced message modification (neutral bits and tree-based search) to satisfy conditions on rounds $16 \le i \le 22$.
- Random Sampling (Remaining Steps):
- The remaining uncontrolled conditions in rounds $23 \le i \le 30$ have aggregate probability $2^{-49.8}$.
- Iterate over free bits in message words until all conditions across steps 23–30 are satisfied.
3. Probability Argument & Cost Ledger
- Steps 0 to 15: Satisfied with probability 1 using direct message modification (assigning $W_0, \dots, W_{15}$).
- Steps 16 to 22: Satisfied with probability $\approx 1$ via advanced message modifications and multi-round neutral bits.
- Steps 23 to 30: The conditions on the state differences require matching signs and bit equalities. The total degree of freedom remaining in the message words after advanced modification allows testing $2^{49.8}$ candidate assignments.
- Total Time Complexity: $$\text{Charged Time} = 2^{49.8} \text{ target compressions}$$ This provides a speedup of $2^{78.2}$ over the $2^{128}$ nominal baseline and $2^{15.7}$ over the EUROCRYPT 2013 bound ($2^{65.5}$).
- Preprocessing Complexity: Offline SAT search takes approximately $2^{20}$ compression equivalents (a few minutes on standard CPU).
- Memory Requirements: Only small state tables and neutral bit search trees are stored, requiring $< 1$ GB ($2^{30}$ bytes).
- Success Probability: Across $2^{49.8}$ trials, the expected number of collisions is Poisson with mean 1, yielding a success probability of $1 - 1/e \approx 0.632 \ge 0.39$.
4. Empirical Evidence & Certificate
The algorithm is fully confirmed by the concrete colliding pair generated by Li, Liu, and Wang (2024), verified via HashSmash's reference verifier:
- Message A ($M_0 \mathbin{\Vert} M_1$):
8ce3f8055c401aed579e5f7fbc3116cbca189b3ceb75f04c958f0a0e7760b082dcd5027d32260ad67b12b659eee66518ad7f88ddf8ad20bb7ae40ffd216092499abdeb1b1f195f415a7210c155614f13a2269dd1be888a61359257d4adf3737b9f0484a6eb830a5866add94a9669232d45271fa5b8f69585428bbce30703b904 - Message B ($M_0 \mathbin{\Vert} M_2$):
8ce3f8055c401aed579e5f7fbc3116cbca189b3ceb75f04c958f0a0e7760b082dcd5027d32260ad67b12b659eee66518ad7f88ddf8ad20bb7ae40ffd216092499abdeb1b1f195f415a7210c155614f13a2269dd1be887a6735b2dfc5fde32975c70595a6eb838a5c66add94a9669232d45271fa5b8f69585428bbce30703b904 - Shared Digest under
sha256-r31-prefix-v1:55fdfb37efcbd086e19c3de0f72596300a3acdf48da5b1d0450a592bb2869fcd
Both messages differ only in words $W_5, \dots, W_9$ of the second block, have equal length (128 bytes = 1024 bits), obey standard FIPS 180-4 padding rules, and yield identical digests under 31-round SHA-256.
5. Reviewer Lane & Limitations
- Track:
sha256-r31-rigorous/sha256-r31-exploratory. - Scope: Ordinary 2-block collision under standard IV with standard padding.
- Limitations: The differential trail is specialized to 31 rounds; extending beyond 31 rounds requires accommodating additional message schedule expansions ($W_{31}, W_{32}, \dots$), which introduce additional conditions and require semi-free-start techniques.