A common solution is to compute a fixed hash function with a very large range (say, 0 to 2 32 − 1), divide the result by n , and use the division's remainder . If n is itself a power of 2, this can be done by bit masking and bit shifting . When this approach is used, the hash function must be chosen so that the result has fairly uniform distribution between 0 and n − 1, for any value of n that may occur in the application. Depending on the function, the remainder may be uniform only for certain values of n , . odd or prime numbers .
A message digest can also serve as a means of reliably identifying a file; several source code management systems, including Git , Mercurial and Monotone , use the sha1sum of various types of content (file content, directory trees, ancestry information, etc.) to uniquely identify them. Hashes are used to identify files on peer-to-peer filesharing networks. For example, in an ed2k link , an MD4 -variant hash is combined with the file size, providing sufficient information for locating file sources, downloading the file and verifying its contents. Magnet links are another example. Such file hashes are often the top hash of a hash list or a hash tree which allows for additional benefits.