2つのファイルが同じか確かめる方法
- 1つ目
- 2つ目
- 見くらべる
名前の違う2つのファイルが、同じ内容かどうか。見た目や容量では、確実なことは分かりません。ファイルのハッシュ値を調べる(SHA-256) でハッシュ値を調べて比べれば、確かめられます。
手順
- 「ファイルを1つ選ぶ」で、1つ目のファイルを選びます。
- 表示されたハッシュ値(SHA-256)を、「SHA-256をコピー」でコピーして、メモしておきます。
- 「別のファイルを選ぶ」を押し、2つ目のファイルを選びます。
- 2つ目のハッシュ値が、表示されます。
- 2つの値を比べます。一致していれば、同じ内容です。
照合機能を使う方法
- 1つ目のファイルを選び、ハッシュ値をコピーする。
- 「別のファイルを選ぶ」で、2つ目を選ぶ。
- 「照合したい値」に、1つ目の値を貼り付ける。
- 「照合する」を押す。一致しなければ「一致しません」と出る。
同じと判断できる場合
- ハッシュ値が、完全に一致する
違うと判断できる場合
- ハッシュ値が、1文字でも違う
注意:見た目は同じでも違う
写真を再保存したり、PDFを開いて保存し直したりすると、見た目は同じでも、中身(データ)が変わる場合があります。その場合は、ハッシュ値が異なります。
向いている場面
- バックアップが、正しくコピーされたか確認する
- 似た名前のファイルが、同じ内容か調べる
- 重複しているファイルを、見つける
- 送ったファイルと、届いたファイルが同じか確認する
例
「報告書_最終.pdf」と「報告書_最終2.pdf」が、同じかどうか分からなかった。ハッシュ値を調べると、一致。どちらか一方を削除してよいと分かった。
つまずきやすい点
- ファイルの更新日時が違うだけ:中身が同じなら、ハッシュ値は同じ。
- 見た目は同じなのに、一致しない:内部のデータが違う。
- ファイルが大きい:時間がかかる。
よくある質問
ファイル名が違っても、ハッシュ値は同じになりますか?
中身が同じなら、同じです。
まとめ
2つのハッシュ値を比べて、一致すれば同じ内容。見た目だけで判断しないのがコツです。
ファイルのハッシュ値を調べる(SHA-256)を使う(無料)あわせて使えるツール
- ZIPを開く(解凍):ZIPの中身を見て、ほしいファイルだけ取り出します。
- ファイルをZIPにまとめる:複数のファイルを、1つのZIPにまとめます。
- 安全なパスワードを作る(ランダム生成):強いランダムなパスワードを、すぐに作ります。
同じツールの、ほかの解説
How to Tell Whether Two Files Are Identical
- First
- Second
- Compare
Whether two files with different names have the same contents cannot be known for certain from appearance or size. Checking and comparing their hash values with Check a File's Hash (SHA-256) settles it.
Steps
- With "Choose one file", choose the first file.
- Copy the displayed hash (SHA-256) with "Copy SHA-256" and note it down.
- Press "Choose another file" and choose the second file.
- The second hash is displayed.
- Compare the two values. If they match, the contents are the same.
Using the compare feature
- Choose the first file and copy its hash.
- Choose the second with "Choose another file".
- Paste the first value into "Value to compare".
- Press "Compare". If they do not match, "No match" appears.
When you can judge them the same
- The hashes match completely
When you can judge them different
- The hashes differ by even one character
Caution: looks the same but differs
Re-saving a photo or opening and re-saving a PDF may change the contents (data) even though it looks the same. In that case the hashes differ.
Good for
- Checking that a backup was copied correctly
- Checking whether files with similar names have the same contents
- Finding duplicate files
- Checking that a sent file and the received file are the same
Example
Could not tell whether "report_final.pdf" and "report_final2.pdf" were the same. Checking the hashes, they matched. It was clear that one of them could be deleted.
Common stumbling blocks
- Only the modified date differs: if the contents are the same, the hash is the same.
- Looks the same yet does not match: the internal data differs.
- The file is large: it takes time.
Frequently asked questions
Even if the file names differ, is the hash the same?
If the contents are the same, yes.
Summary
Compare two hashes; if they match, the contents are the same. The tip is not to judge by appearance alone.
Use "Check a File's Hash (SHA-256)" (free)Tools that go well with this
- Open a ZIP File (Unzip): See what is inside a ZIP and extract the files you need.
- Make a ZIP File: Pack several files into one ZIP.
- Generate a Strong Random Password: Generate strong random passwords instantly.