In computer software, a hash
is a relatively small integer derived from a larger integer, string or some kind of object, a key or a file.
The number is produced by a hash function.
For example, a simple, although very poor way, to calculate a hash of a string is by adding the ascii codes for each digit together. The answer is a hash of the string. Note that two strings such as "ab" and "ba" would have the same hash. It's quite normal for two strings to hash to the same number, in fact it's nearly always inevitable because the hash is shorter. This is called a 'collision'.
Hashes are often used in conjunction with a hash table; but need not be.
Alternatively a hash can also be calculated and stored; it can then be used as a quick way to prove that two things aren't 'equal' very rapidly- clearly if the hashes are different, then you know straight away they aren't the same.
However, if the hashes match, you often still need to do a full comparison of the data to check that it wasn't a collision; but in many cases, the full comparison will usually almost immediately fail for collisions, because the hash compares them in a different way.
Also, if a large enough hash and a very carefully chosen hash function is used, the chances of finding two things being different, but having the same hash can be incredibly small, small enough that you wouldn't find an example if you looked for billions of years on the fastest computer. In that case, you may not need to do the full comparison at all; this is used as a way of instantly comparing files, even if the files are many gigabytes in size. This idea is used very extensively.
Hashes are used for digital signing of documents, files, or programs- any modification to the document changes the hash. The hashes used for this purpose are very carefully designed using cryptographic theory for extremely high security so that people deliberately trying to construct files which have the same hash are unable to do so in any reasonable time.