Interesting you should bring that up, as I did use a hashing function for part of this assignment.
A hash function doesn't really have any universal form. It is a bitstring of some length that has the property that if H(m) = H(m'), then m = m' with probability dependant on the characteristics of the function and, mostly, the length of the hash bitstring. There are several hash functions with lengths of 32 bits - most of them are part of a class of functions called checksum codes, whose primary purpose is to detect changes in a message. If you store a message then its checksum, then a reader can verify the checksum and do something if it doesn't check out.
There are, however, a ton of hash functions that result in larger that 32 bits. Every modern cryptographic hash function (also referred to as a message digest), in order to be useful, has a length of at least 128 bits, or 4 ints.
Generally speaking, you can think of a hash function as returning a _number_ of some fixed bitlength. A hashing function, since it takes a potentially unlimited amount of data and condenses it into a fixed-length hash, necessarily loses data in the process. A hash function generally just mashes the data around to form the hash, but some are better/faster than others (and, generally, the better it is, the slower it is). Often, a hash is calculated by taking blocks of data from the message to be hashed and the current hash and returning a new hash (of the same length, obviously). Repeat this for all blocks of the message and you have the final hash/checksum. It varies though - many checksums operate on blocks of a byte or 4 bytes, while cryptographic hashes operate on anywhere from 32 to 128 bytes.
An example of a checksum code is CRC-32, which returns a 32-bit checksum. An exmaple of a cryptographic hash is SHA-1 or MD5. CRC-32 is many orders of magnitude faster than either of the two cryptographic hashs, but the cryptographic hashs are far more useful in many circumstances. Google gives you some good info searching for any of these. |