什麼是雜湊值?
- 瞭解
- 使用
A software download page lists a long string of letters and digits called "SHA-256". What is it for? That is a hash value. Here is a gentle explanation of the basics of the hash value that Check a File's Hash (SHA-256) can check.
What a hash is
It turns a file's contents, by a fixed calculation, into a string of fixed length. It is compared to the file's "fingerprint".
Characteristics of a hash
- Same contents, same value: the result is the same however many times it is calculated.
- One character different, a totally different value: even a slight difference changes the value greatly.
- Cannot be reversed: the original file cannot be restored from the value.
- Fixed length: the same length (64 characters for SHA-256) whether the file is large or small.
What it is used for
- Checking downloads: whether it downloaded correctly.
- Detecting tampering: whether it was rewritten on the way.
- Judging whether files are the same: whether two files have the same contents.
- Finding duplicate files: files with the same value have the same contents.
Steps (checking)
- Choose a file with "Choose one file".
- After a short wait, the hash (SHA-256) is displayed.
- Copy it with "Copy SHA-256".
What a hash cannot tell you
- The file's safety (whether it has a virus)
- The file's author or origin
- Whether the file's contents are correct
A hash is for checking "whether it is the same".
Relation to passwords
Services sometimes store passwords not as they are but as hashes. The same mechanism is used.
示例
Checking the hashes of two backup files gave the same value. Although the file names differed, the contents were the same.
Common stumbling blocks
- Confusing it with "encryption": a hash cannot be reversed. Encryption can be undone with a key.
- Comparing only part of the value: it is not certain unless you compare all of it.
Frequently asked questions
If the hashes are the same, is it certainly the same file?
In practice, if the SHA-256 is the same, it is fine to consider it the same file.
小結
A hash is a file's fingerprint. It is used to check whether things are the same.
使用「檢視檔案的雜湊值(SHA-256)」(免費)搭配使用的工具
- 開啟 ZIP 檔案(解壓):檢視 ZIP 裡有什麼,只取出需要的檔案。
- 把檔案打包成 ZIP:把多個檔案打包成一個 ZIP。
- 生成高強度隨機密碼:立即生成高強度隨機密碼。