Assume I have a password that is exactly 32 characters long. I hash it the following way:

  • Prepend 1524 bytes (known to an attacker)
  • Append 3356 bytes (known to an attacker)
  • Do the checksum

It is clearly visible that only a tiny part of the plaintext is variable.

Assume the attacker stole the checksum from a DB. How difficult would it be for them to recover the password or create a collision? What checksum algorithms are more resistant against that?

Yes, I know that one cannot recover a password from a 16-bit CRC-16. Let's assume that the checksum is at least 128 bits long.

What would change if one of pads would disappear?


Except against rainbow tables, it makes no difference whether you've prepended or appended any bytes if they're known and static. Both may as well not exist.

So the scenario is reduced to "doing a checksum of" (presumably trying to hash) a 32-byte password.

There isn't a CRC-128 in common use, but if you extended the CRC algorithm to 128 bits, you'd get a completely insecure transformation. CRC was designed for simplicity and low collision probability, making it reversible. There's a paper specifically on reversing CRC - https://sar.informatik.hu-berlin.de/research/publications/SAR-PR-2006-05/SAR-PR-2006-05_.pdf - and the process can be implemented by a decent high school student.

Algorithms resistant to that - producing a true one-way transformation - are called hashing algorithms, not checksums. Popular examples of hashing algorithms include SHA-3 and SHA-2.

For passwords specifically, an even higher level of security is often called for, such as using key derivation functions (PBKDF) - bcrypt, scrypt, argon2. In addition to the quasi-randomness property that hashes have and CRC don't, PBKDF deliberately tie up additional computer resources to somewhat improve their brute-force resistance.

  • $\begingroup$ The naming was always a problem to me ;) just didn't see a difference between checksum and hash. Thanks for a quick answer! $\endgroup$ – Top Sekret Apr 11 '18 at 9:03

Let's be clear:

A hash is just a checksum that is intended to be difficult to reverse.

If you are using an actual "checksum" algorithm then it will be simple to recover the key.

If you are using a hash then you just have hash(f(x)) which is as secure as a common-salted hash.

  • $\begingroup$ Hi Full Decent. It seems to me you can provide insightful answers and this one comes rather close. But there are some issues with how the answer is written down: Please only use quoting for actual quotes, not for highlighting. Just stating that it "will be simple to recover the key" is not enough. Do explain why this is the case, even if just with a reference. Same issue with the last sentence. $\endgroup$ – Maarten Bodewes Apr 10 '18 at 22:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.