AI EncyclopediaChips & deep techMore concepts 1
Hash function
해시
A calculation method that turns data into a short value of fixed length.
Overview
A hash is a function that turns long data into a short value of a set length, called a hash value. The same input always gives the same value, and even a small change to the input changes the result greatly. Because it is hard to recover the original content from the result, it forms the basis of many security technologies.
Hashes came into wide use out of the need to check that a file has not been changed along the way. They also became a basic tool of computer science, used in data structures that compare and look up large amounts of data quickly. Storing passwords in a hashed form rather than as plain text also started from this background.
How it works
A hash function makes an output of fixed length by repeating operations that mix and cut the input data many times. It is designed so that a small difference in the input spreads through the whole output. So it is extremely hard to work backward from the result to guess the original input.
If you use the same hash function, two people who each calculate it get the same value, which makes comparison possible. By comparing a stored hash value with a newly calculated one, you can check whether the content has changed.
Where it is used
For passwords, the hash value is stored instead of the original text. At login, the entered value is calculated the same way and compared. If you compare the hash value of a downloaded file with a published value, you can check for damage or tampering.
In real use, you should choose a proven function with strong collision resistance, such as SHA-256. For storing passwords, you need a dedicated method that adds a salt and calculates slowly to be safe.
Limits and misconceptions
Unlike encryption, a hash is not meant for turning a stored value back into the original text. In theory there are different inputs that produce the same value, called collisions, so it is better not to use old functions.
A common misunderstanding is to think that using a hash makes data completely secret. If the possible inputs are few, an attack that precalculates common values and matches them is possible, so a safeguard such as a salt is needed.
An everyday example
It is like compressing a paper document into a short seal-like mark. If you change even one letter of the document, the mark becomes completely different, so you can tell it has been tampered with.
Why it matters
Understanding hashes lets you see why technologies such as password storage, file integrity checks and blockchain do not keep the original data directly. Hash values also appear often when security incidents are analyzed, so it helps to know them.
Sources and further reading
Also calledhash