encyclopegia.org

Preimage attack

In cryptography, a preimage attack on cryptographic hash functions tries to find a message that has a specific hash value. A cryptographic hash function should resist attacks on its preimage (set of possible inputs). In the context of attack, there are two types of preimage resistance: * preimage resistance: for essentially all pre-specified outputs, it is computationally infeasible to find any input that hashes to that output; i.e., given , it is difficult to find an such that . * second-preimage resistance: for a specified input, it is computationally infeasible to find another input which produces the same output; i.e., given , it is difficult to find a second input such that . These can be compared with a collision resistance, in which it is computationally infeasible to find any two distinct inputs , that hash to the same output; i.e., such that . Collision resistance implies second-preimage resistance, but does not guarantee preimage resistance. However, under certain assumptions of the range of the hash function, collision resistance does imply preimage resistance (by a provisional implication) . Conversely, a second-preimage attack implies a collision attack (trivially, since, in addition to , is already known right from the start). Via the provisional implication, a preimage attack will also imply a second-preimage attack, which then also extends to a collision attack.

In cryptography, a preimage attack on cryptographic hash functions tries to find a message that has a specific hash value. A cryptographic hash function should resist attacks on its preimage (set of possible inputs). In the context of attack, there are two types of preimage resistance: preimage resistance: for essentially all pre-specified outputs, it is computationally infeasible to find any input that hashes to that output; i.e., given , it is difficult to find an such that . second-preimage resistance: for a specified input, it is computationally infeasible to find another input which produces the same output; i.e., given , it is difficult to find a second input such that . These can be compared with a collision resistance, in which it is computationally infeasible to find any two distinct inputs , that hash to the same output; i.e., such that . Collision resistance implies second-preimage resistance, but does not guarantee preimage resistance. However, under certain assumptions of the range of the hash function, collision resistance does imply preimage resistance (by a provisional implication) . Conversely, a second-preimage attack implies a collision attack (trivially, since, in addition to , is already known right from the start). Via the provisional implication, a preimage attack will also imply a second-preimage attack, which then also extends to a collision attack. By definition, an ideal hash function is such that the fastest way to compute a first or second preimage is through a brute-force attack. For an -bit hash, this attack has a time complexity , which is considered too high for a typical output size of = 128 bits. If such complexity is the best that can be achieved by an adversary, then the hash function is considered preimage-resistant. However, there is a general result that quantum computers perform a structured preimage attack in \sqrt{2^{n}} = 2^{\frac{n}{2}} , which also implies second preimage and thus a collision attack. Faster preimage attacks can be found by cryptanalysing certain hash functions, and are specific to that function. Some significant preimage attacks have already been discovered, but they are not yet practical. If a practical preimage attack is discovered, it would drastically affect many Internet protocols. In this case, "practical" means that it could be executed by an attacker with a reasonable amount of resources. For example, a preimaging attack that costs trillions of dollars and takes decades to preimage one desired hash value or one message is not practical; one that costs a few thousand dollars and takes a few weeks might be very practical. All currently known practical or almost-practical attacks on MD5 and SHA-1 are collision attacks. In general, a collision attack is easier to mount than a preimage attack, as it is not restricted by any set value (any two values can be used to collide). The time complexity of a brute-force collision attack, in contrast to the preimage attack, is only 2^{\frac{n}{2}} . ===Restricted preimage space attacks=== The computational infeasibility of a first preimage attack on an ideal hash function assumes that the set of possible hash inputs is too large for a brute force search. However if a given hash value is known to have been produced from a set of inputs that is relatively small or is ordered by likelihood in some way, then a brute force search may be effective. Practicality depends on the input set size and the speed or cost of computing the hash function. A common example is the use of hashes to store password validation data for authentication. Rather than store the plaintext of user passwords, an access control system stores a hash of the password. When a user requests access, the password they submit is hashed and compared with the stored value. If the stored validation data is stolen, the thief will only have the hash values, not the passwords. However most users choose passwords in predictable ways and many passwords are short enough that all possible combinations can be tested if fast hashes are used, even if the hash is rated secure against preimage attacks. Special hashes called key derivation functions have been created to slow searches. See Password cracking. For a method to prevent the testing of short passwords see salt (cryptography).

References

  1. Quantum attacks against Blue Midnight Wish, ECHO, Fugue, Grøstl, Hamsi, JH, Keccak, Shabal, SHAvite-3, SIMD, and Skein · retrieved 2020-03-28 · rev 1364336444
    Cite this reference

    MLA "Quantum attacks against Blue Midnight Wish, ECHO, Fugue, Grøstl, Hamsi, JH, Keccak, Shabal, SHAvite-3, SIMD, and Skein." Daniel J. 2020-03-28. https://cr.yp.to/hash/quantumsha3-20101112.pdf. Accessed 24 November 2026.

    Chicago "Quantum attacks against Blue Midnight Wish, ECHO, Fugue, Grøstl, Hamsi, JH, Keccak, Shabal, SHAvite-3, SIMD, and Skein." Daniel J. 2020-03-28. https://cr.yp.to/hash/quantumsha3-20101112.pdf.

    APA Daniel J. (2020). Quantum attacks against Blue Midnight Wish, ECHO, Fugue, Grøstl, Hamsi, JH, Keccak, Shabal, SHAvite-3, SIMD, and Skein. Retrieved November 24, 2026, from https://cr.yp.to/hash/quantumsha3-20101112.pdf

  2. Why We Need to Move to SHA-2 · retrieved 2026-11-17 · rev 1364336444
    Cite this reference

    MLA "Why We Need to Move to SHA-2." Bruce Morton; Clayton Smith (2014-01-30). 2026-11-17. https://casecurity.org/2014/01/30/why-we-need-to-move-to-sha-2/. Accessed 24 November 2026.

    Chicago "Why We Need to Move to SHA-2." Bruce Morton; Clayton Smith (2014-01-30). 2026-11-17. https://casecurity.org/2014/01/30/why-we-need-to-move-to-sha-2/.

    APA Bruce Morton; Clayton Smith (2014-01-30). (2026). Why We Need to Move to SHA-2. Retrieved November 24, 2026, from https://casecurity.org/2014/01/30/why-we-need-to-move-to-sha-2/

  3. Google Online Security Blog: Announcing the first SHA1 collision · retrieved 2017-02-22 · rev 1364336444
    Cite this reference

    MLA "Google Online Security Blog: Announcing the first SHA1 collision." 2017-02-22. https://security.googleblog.com/2017/02/announcing-first-sha1-collision.html. Accessed 24 November 2026.

    Chicago "Google Online Security Blog: Announcing the first SHA1 collision." 2017-02-22. https://security.googleblog.com/2017/02/announcing-first-sha1-collision.html.

    APA encyclopegia.org. (2017). Google Online Security Blog: Announcing the first SHA1 collision. Retrieved November 24, 2026, from https://security.googleblog.com/2017/02/announcing-first-sha1-collision.html

  4. MD5 and Perspectives · retrieved 2026-11-17 · rev 1364336444
    Cite this reference

    MLA "MD5 and Perspectives." 2026-11-17. https://www.cs.cmu.edu/~perspectives/md5.html. Accessed 24 November 2026.

    Chicago "MD5 and Perspectives." 2026-11-17. https://www.cs.cmu.edu/~perspectives/md5.html.

    APA encyclopegia.org. (2026). MD5 and Perspectives. Retrieved November 24, 2026, from https://www.cs.cmu.edu/~perspectives/md5.html

  5. 25-GPU cluster cracks every standard Windows password in <6 hours · retrieved 2020-11-22 · rev 1364336444
    Cite this reference

    MLA "25-GPU cluster cracks every standard Windows password in <6 hours." Goodin, Dan (2012-12-10). 2020-11-22. https://arstechnica.com/information-technology/2012/12/25-gpu-cluster-cracks-every-standard-windows-password-in-6-hours/. Accessed 24 November 2026.

    Chicago "25-GPU cluster cracks every standard Windows password in <6 hours." Goodin, Dan (2012-12-10). 2020-11-22. https://arstechnica.com/information-technology/2012/12/25-gpu-cluster-cracks-every-standard-windows-password-in-6-hours/.

    APA Goodin, Dan (2012-12-10). (2020). 25-GPU cluster cracks every standard Windows password in <6 hours. Retrieved November 24, 2026, from https://arstechnica.com/information-technology/2012/12/25-gpu-cluster-cracks-every-standard-windows-password-in-6-hours/

  6. Cryptographic Hash-Function Basics: Definitions, Implications, and Separations for Preimage Resistance, Second-Preimage Resistance, and Collision Resistance · retrieved 2026-11-17 · rev 1364336444
    Cite this reference

    MLA "Cryptographic Hash-Function Basics: Definitions, Implications, and Separations for Preimage Resistance, Second-Preimage Resistance, and Collision Resistance." a b c d e Rogaway, P. 2026-11-17. https://web.cs.ucdavis.edu/~rogaway/papers/relates.pdf. Accessed 24 November 2026.

    Chicago "Cryptographic Hash-Function Basics: Definitions, Implications, and Separations for Preimage Resistance, Second-Preimage Resistance, and Collision Resistance." a b c d e Rogaway, P. 2026-11-17. https://web.cs.ucdavis.edu/~rogaway/papers/relates.pdf.

    APA a b c d e Rogaway, P. (2026). Cryptographic Hash-Function Basics: Definitions, Implications, and Separations for Preimage Resistance, Second-Preimage Resistance, and Collision Resistance. Retrieved November 24, 2026, from https://web.cs.ucdavis.edu/~rogaway/papers/relates.pdf

Cite this article

MLA

"Preimage attack." encyclopegia.org, 2026, https://encyclopegia.org/wiki/preimage-attack. Accessed 24 November 2026.

Chicago

"Preimage attack." encyclopegia.org. Accessed November 24, 2026. https://encyclopegia.org/wiki/preimage-attack.

APA

encyclopegia.org. (2026). Preimage attack. Retrieved November 24, 2026, from https://encyclopegia.org/wiki/preimage-attack

Accessed November 24, 2026 · CC BY-SA 4.0 · citation page · JSON

Related articles

2-Headed Shark Attack

stub · references available

Zombie Attack

stub · references available

Owen Sound Attack

stub · references available

Stonewall Attack

stub · references available

Ansbach school attack

stub · references available

Attack on the Pin-Up Boys

stub · references available

Muna Hotel attack

stub · references available
CC BY-SA 4.0 · share-alike · https://en.wikipedia.org/w/index.php?oldid=1364336444 · 0.5 · snapshot enwiki-001364336444

Cite · JSON · Search

Related services and records

Services

  • Estate — measured countries, lanes and facts
  • Intel — live corroborated events
  • Legal — statutes, cases and citations
  • Encyclopedia — articles with inline sources
  • Space — launches, satellites and orbits
  • Search — federated search and reports
  • Pass — passport account and SSO
  • Corpora — read-only corpus origins
  • e01 — self-hosted corpora and tools

Text and metadata only; each target carries its own sources. Missing data is published as no-data, never estimated.