Hashing Algorithm

From Conservapedia
This is an old revision of this page, as edited by DavidB4-bot (talk | contribs) at 23:57, March 28, 2019. It may differ significantly from current revision.
Jump to navigation Jump to search

In computing, a hashing algorithm is a computational process which takes an input of bytes and reduces it to a fixed length base64 string which is unique (within boundaries) to the input. Hashes are mainly used for data integrity, and with further asymmetrical algorithms as digital signatures.

Method

Hashes are computed by churning down a large size byte array until it reaches the target size. If the initial byte array length is not divisible by the target size then the initial array is buffered with blank bits or the provided bits are repeated, to ensure the algorithm will compute down to the target length. One important characteristic of hashing algorithms is that the hash should not be reversible.

Collisions

A hash is intended to be completely unique to a given set of bytes. However, this is not always the case. Given enough processing effort, an identical hash can be produced using alternative input data. This is known as a hash collision, when two pieces of data produce the same hash. It is a security risk for such collisions to be feasibly created, since original data can be replaced with alternate data, and the hash still indicates that nothing was changed. For this reason, large key sizes are preferred for hashing, since they make it much more difficult to produce a collision. Typically, any collision which is found would only replace valid data with gibberish. However, this is not guaranteed; given enough computing effort, it is possible to replace data is a meaningful way while still matching the hash.
Algorithms such as MD5[1][2] and SHA-1[3] have been "broken" by producing collisions.

MD5

MD5 became a computing standard [4] for hashing but was subsequently found to be insecure[5] and was replaced with SHA1. MD5 breaks the input up into 512-bit blocks and churns it down into a 128-bit bit hash. For example, the text "The quick brown fox jumps over the lazy dog" would become (base64 encoded): 50842ef1bd9a95a284b395a0f0e0e2f8

SHA-1

SHA (Secure Hash Algorithm) is a set of functions for hashing which fixed the problems found in MD5 and has since become the industry standard. SHA1 hashes down to a 160-bit hash. For example, the text "The quick brown fox jumps over the lazy dog" would become (base64 encoded): 1305dca26f7ef6e660c5c54948c1050cc3253b18 SHA-1 has been found not to have sufficient complexity to reduce collisions, so is now disfavored.

SHA-2

SHA-2 (typically SHA-256) is an updated version of SHA-1, which adds complexity to help reduce the chance of hash collisions. "SHA-224," "SHA-384," and "SHA-512" are also forms of SHA-2, which are using other key lengths; the trailing number states the key length in use. The greater the key size, the more difficult it is to have a hash collision, as this produces a longer hash. For example, the text "The quick brown fox jumps over the lazy dog" using SHA-256 would produce: C8554AB924067605CFEB06DE2EC69D7FAF1648EFBF027273FA4DAB8F7CED086B

Using a 512 bit key (SHA-512), it would produce this much longer hash: 07E547D9586F6A73F73FBAC0435ED76951218FB7D0C8D788A309D785436BBB642E93A252A954F23912547D1E8A3B5ED6E1BFD7097821233FA0538F3DB854FEE6

References