2 replaced http://security.stackexchange.com/ with https://security.stackexchange.com/
source | link

A cryptographic hash function is a function which everybody can compute efficiently (there is nothing secret about it), and which offers some interesting characteristics:

  • It accepts as input a sequences of its (or bytes) of arbitrary length (in practice without any upper bound).
  • Its output has a fixed, small size (128 bits for MD5, 160 bits for SHA-1).
  • It is deterministic (hash the same input twice, possibly with different machines or implementations, and you will still get the same output twice).
  • It is so much entangled that it resists collisions, preimages and second preimages.

For the scenario at hand, collisions are not an issue. Preimage resistance is about the impossibility of finding a message m which, when hashed, yields a given output. Second preimage resistance is similar: you know a message m, which, when hashed, yields some output x, and you cannot find another message m' (distinct from m) which yields the same output. How this impossibility is achieved is a rather complex subject (see thisthis).

The small output size is the reason we use them for downloads. If you obtain the MD5 hash from a reputable source (the SSL-enabled Web site of the publisher), then you can download the actual data from anywhere, e.g. a P2P network like BitTorrent. Once you have the data, you hash it (on your machine) and then check that the MD5 or SHA-1 hash value matches the one you got from the reputable source. On match, you know that you have the right file, down to the last bit, because, in order to feed you an altered file while keeping the correct hash value, an ill-intentioned attacker would have to break second preimage resistance of the hash function -- and, right now, nobody knows how to do that.

If you download the file from the same source as the hash value, then the hash value is kind of useless. The added value for security of the published MD5 or SHA-1 is in the situation where the bulk data is obtained through a "weak" medium, while the hash value is transferred securely.


Hash values are also great for detecting errors. They are meant to resist modifications of the data by intelligent attackers who know what they are doing; this also makes them robust against random alteration from a mindless universe. Hash functions are very good checksums. If you download a big file, say an ISO image, burn it on a DVD, then read back the DVD on some other machine, then there is ample room for non-malicious alterations, in particular bad RAM on either machine (flipped bits occur more often than usually assumed). At any time, you can recompute the hash on the data, and see if it matches the expected value.

A cryptographic hash function is a function which everybody can compute efficiently (there is nothing secret about it), and which offers some interesting characteristics:

  • It accepts as input a sequences of its (or bytes) of arbitrary length (in practice without any upper bound).
  • Its output has a fixed, small size (128 bits for MD5, 160 bits for SHA-1).
  • It is deterministic (hash the same input twice, possibly with different machines or implementations, and you will still get the same output twice).
  • It is so much entangled that it resists collisions, preimages and second preimages.

For the scenario at hand, collisions are not an issue. Preimage resistance is about the impossibility of finding a message m which, when hashed, yields a given output. Second preimage resistance is similar: you know a message m, which, when hashed, yields some output x, and you cannot find another message m' (distinct from m) which yields the same output. How this impossibility is achieved is a rather complex subject (see this).

The small output size is the reason we use them for downloads. If you obtain the MD5 hash from a reputable source (the SSL-enabled Web site of the publisher), then you can download the actual data from anywhere, e.g. a P2P network like BitTorrent. Once you have the data, you hash it (on your machine) and then check that the MD5 or SHA-1 hash value matches the one you got from the reputable source. On match, you know that you have the right file, down to the last bit, because, in order to feed you an altered file while keeping the correct hash value, an ill-intentioned attacker would have to break second preimage resistance of the hash function -- and, right now, nobody knows how to do that.

If you download the file from the same source as the hash value, then the hash value is kind of useless. The added value for security of the published MD5 or SHA-1 is in the situation where the bulk data is obtained through a "weak" medium, while the hash value is transferred securely.


Hash values are also great for detecting errors. They are meant to resist modifications of the data by intelligent attackers who know what they are doing; this also makes them robust against random alteration from a mindless universe. Hash functions are very good checksums. If you download a big file, say an ISO image, burn it on a DVD, then read back the DVD on some other machine, then there is ample room for non-malicious alterations, in particular bad RAM on either machine (flipped bits occur more often than usually assumed). At any time, you can recompute the hash on the data, and see if it matches the expected value.

A cryptographic hash function is a function which everybody can compute efficiently (there is nothing secret about it), and which offers some interesting characteristics:

  • It accepts as input a sequences of its (or bytes) of arbitrary length (in practice without any upper bound).
  • Its output has a fixed, small size (128 bits for MD5, 160 bits for SHA-1).
  • It is deterministic (hash the same input twice, possibly with different machines or implementations, and you will still get the same output twice).
  • It is so much entangled that it resists collisions, preimages and second preimages.

For the scenario at hand, collisions are not an issue. Preimage resistance is about the impossibility of finding a message m which, when hashed, yields a given output. Second preimage resistance is similar: you know a message m, which, when hashed, yields some output x, and you cannot find another message m' (distinct from m) which yields the same output. How this impossibility is achieved is a rather complex subject (see this).

The small output size is the reason we use them for downloads. If you obtain the MD5 hash from a reputable source (the SSL-enabled Web site of the publisher), then you can download the actual data from anywhere, e.g. a P2P network like BitTorrent. Once you have the data, you hash it (on your machine) and then check that the MD5 or SHA-1 hash value matches the one you got from the reputable source. On match, you know that you have the right file, down to the last bit, because, in order to feed you an altered file while keeping the correct hash value, an ill-intentioned attacker would have to break second preimage resistance of the hash function -- and, right now, nobody knows how to do that.

If you download the file from the same source as the hash value, then the hash value is kind of useless. The added value for security of the published MD5 or SHA-1 is in the situation where the bulk data is obtained through a "weak" medium, while the hash value is transferred securely.


Hash values are also great for detecting errors. They are meant to resist modifications of the data by intelligent attackers who know what they are doing; this also makes them robust against random alteration from a mindless universe. Hash functions are very good checksums. If you download a big file, say an ISO image, burn it on a DVD, then read back the DVD on some other machine, then there is ample room for non-malicious alterations, in particular bad RAM on either machine (flipped bits occur more often than usually assumed). At any time, you can recompute the hash on the data, and see if it matches the expected value.

1
source | link

A cryptographic hash function is a function which everybody can compute efficiently (there is nothing secret about it), and which offers some interesting characteristics:

  • It accepts as input a sequences of its (or bytes) of arbitrary length (in practice without any upper bound).
  • Its output has a fixed, small size (128 bits for MD5, 160 bits for SHA-1).
  • It is deterministic (hash the same input twice, possibly with different machines or implementations, and you will still get the same output twice).
  • It is so much entangled that it resists collisions, preimages and second preimages.

For the scenario at hand, collisions are not an issue. Preimage resistance is about the impossibility of finding a message m which, when hashed, yields a given output. Second preimage resistance is similar: you know a message m, which, when hashed, yields some output x, and you cannot find another message m' (distinct from m) which yields the same output. How this impossibility is achieved is a rather complex subject (see this).

The small output size is the reason we use them for downloads. If you obtain the MD5 hash from a reputable source (the SSL-enabled Web site of the publisher), then you can download the actual data from anywhere, e.g. a P2P network like BitTorrent. Once you have the data, you hash it (on your machine) and then check that the MD5 or SHA-1 hash value matches the one you got from the reputable source. On match, you know that you have the right file, down to the last bit, because, in order to feed you an altered file while keeping the correct hash value, an ill-intentioned attacker would have to break second preimage resistance of the hash function -- and, right now, nobody knows how to do that.

If you download the file from the same source as the hash value, then the hash value is kind of useless. The added value for security of the published MD5 or SHA-1 is in the situation where the bulk data is obtained through a "weak" medium, while the hash value is transferred securely.


Hash values are also great for detecting errors. They are meant to resist modifications of the data by intelligent attackers who know what they are doing; this also makes them robust against random alteration from a mindless universe. Hash functions are very good checksums. If you download a big file, say an ISO image, burn it on a DVD, then read back the DVD on some other machine, then there is ample room for non-malicious alterations, in particular bad RAM on either machine (flipped bits occur more often than usually assumed). At any time, you can recompute the hash on the data, and see if it matches the expected value.