Sneaking your data in – hash length extension attacks
As you may recall from our brief introduction to hashes in Chapter 4, Windows Passwords on the Network, hashing isn’t encryption. An encrypted message can be decrypted into a readable message. A cryptographic hash, on the other hand, has no plaintext representation; it cannot be reversed. However, a particular input sent through a particular hashing algorithm will always result in the same hash output (called a one-way function). This makes hashing algorithms useful for integrity checks, as even a slight change to the input produces a radically different hash output. However, let’s consider the fact that a hash’s output is a fixed length, regardless of the message being hashed; for long messages, the hash function is done in rounds on blocks of message data, over and over until the entire message is hashed.
With the result depending on all of the previous inputs, we could – in theory ...