arXiv:2611.00512cs.CROct 2026

Manuscript Offprint

arXiv:2611.00512

Practical Preimages for 19- and 20-Step SHA-256 with Standard Padding

Sebastian R. Wain

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

We present practical preimage attacks on 19- and 20-step SHA-256 that respect the standard IV, Davies-Meyer feed-forward, and full FIPS 180-4 padding, for arbitrary prescribed 256-bit targets. Building on Basra's algebraic selector saturation and backward padding absorption [9], we introduce three techniques: an exact O(1)O(1) inversion of the low padding byte (W13 mod 256)=0x80W_{13} \bmod 256) = 0x80 that leaves (a5,a6)(a_5, a_6) free for exact context shaping; a causal bit-slice equivalence theorem that prunes 99.74% of right-hand candidate nodes across seven stages; and a closed-form F2\mathbb{F}_2 upper-half inverse paired with compact Q0−1Q_0^{-1} lookup tables. One CPU core solves arbitrary 19-step padded targets in 1.2-86.4 s (median 19.5 s) after an 18 s table build. A 20-step padded preimage costs 246.62^{46.6} CPU-reference evaluations: 191 node-hours on one 10-core Apple M4 CPU node (16 threads), or 9.0-22.2 GPU-hours on one NVIDIA L4. A companion Zero-a3a_3 bridge inverts the unpadded 20-step compression function in 238.12^{38.1} evaluations. We provide 46 self-verifying witnesses, including 55-byte preimages of SHA-256("abc") and 02560^{256}. These attacks cover 19–20 of 64 steps and do not threaten full SHA-256.

Keywords: SHA-256 · Preimage attack · Reduced-round cryptanalysis · FIPS 180-4 padding · Algebraic context shaping · Bit-slice pruning

1 Introduction

SHA-256 [1] hashes an LL-bit message MM by appending mandatory Merkle–Damgård strengthening (FIPS 180-4 §5.1.1)—a single '1' bit (0x80 at a byte boundary), zero padding bits, and the 64-bit big-endian bit length LL in the final two 32-bit words W14W_{14} and W15W_{15}—before applying a 64-step Davies–Meyer compression function initialized to the standard initial value IV.

In the cryptanalysis of step-reduced SHA-256, a persistent divide has separated theoretical attacks from practical (demonstrated) preimages:

  • Theoretical preimage and collision attacks: Splice-and-cut meet-in-the-middle (MitM), partial-matching, biclique, and MILP-assisted attacks respect FIPS 180-4 padding from 24 steps [2] through 41–43 steps [3, 10], 45 steps [4], and 46–47 steps [8], with related differential and semi-free-start collision advances reaching 24–39 steps for SHA-256 (and 40 steps for SHA-224) [11, 12, 14, 15] building on the generalized characteristic framework introduced for SHA-1 in [13]. Unlike SHA-1, where full-round collisions have been practically computed [17, 18], all 24–47-step SHA-256 preimage attacks require between 22402^{240} and 2255.62^{255.6} compression evaluations and remain strictly theoretical.

  • Practical (demonstrated) preimages: Algebraic and SAT-based encodings produced padded preimages up to 16 steps [5] and three mailing-list challenge messages at 17 steps (posted without an attack specification) [16]. More recently, SAT/Cube-and-Conquer [6,

7] produced verified preimages at 18 and 19 steps for the unpadded compression function (where all 16 message words W0,…,W15W_0, \ldots, W_{15} are unconstrained 32-bit degrees of freedom), and Basra [9] introduced algebraic selector saturation and context shaping to solve 19- and 20-step unpadded compression targets as well as a 55-byte 20-step padded preimage for a structured target (padded_r20 in [9], dated 17 October 2026).

For a single-block 55-byte (L=440L = 440-bit) padded message, FIPS 180-4 [1] fixes 72 bits at the end of the message block:

W15=440 (0x000001b8),W14=0 (0x00000000),W13 mod 256=0x80.(E1)W_{15} = 440 \ (0x000001b8), \qquad W_{14} = 0 \ (0x00000000), \qquad W_{13} \bmod 256 = 0x80. \tag{E1}

In backward-and-forward inversion of steps 0..18 (19-step) or 0..19 (20-step), W13,W14,W15W_{13}, W_{14}, W_{15} are tightly coupled with the message schedule expansion W16,…,W19W_{16}, \ldots, W_{19} and the internal state window (a5,…,a12a_5, \ldots, a_{12}). Satisfying all 72 padding bits simultaneously with the selector-saturation and majority-absorption conditions [9] that decouple the left and right halves of the compression function is the central barrier to inverting arbitrary externally prescribed 256-bit targets for the padded 19- and 20-step hash functions.