How to get a file hash value

A hash value is basically like a "fingerprint" of a file.

However, this fingerprint is very precise,Data inside the fileTherefore, even a single different character in the file, or even a small, invisible change to the data, will result in a completely different hash value.

Hash values ​​are often used to verify the identity of a file. For example, on this site,Homemade softwareIf the hash value of the software we distribute matches the hash value of the software downloaded by the user, we can be sure that the file is genuine. If they do not match, the following problems may be present:

  • The file version is different
  • The file was corrupted during download
  • A third party has installed a virus or tampered with the data.

This page shows you how to get hash values ​​using Command Prompt and PowerShell.

table of contents

1. How to get the hash value using the command prompt

To get the hash value, use the commandcertutil"Use the.

There are five hash algorithms available:

  • MD2
  • MD4
  • MD5
  • SHA1
  • SHA256
  • SHA384
  • SHA512

How to write the command:

%systemroot%\System32\certutil.exe -hashfile "ファイルのフルパス" SHA256

*Please change the "SHA256" part to the algorithm you want to obtain.

If the file name you specify contains spaces, enclose it in double quotation marks ("").

Algorithm: Example of specifying SHA256

%systemroot%\System32\certutil.exe -hashfile "C:\Program Files\Google\Chrome\Application\chrome.exe" SHA256

Let's open a command prompt and run it.

Learn how to open a command prompt

1. Press Windows key + R to open Run.

2. Type "cmd".

Run
Run

3.Shift + Ctrl + Enter Please press.

Keyboard
Keyboard

If you do not need administrator privileges, just press Enter.

4. When the "User Account Control" message appears, click "Yes".

ユーザーアカウント制御
ユーザーアカウント制御

Enter the command and press Enter to display the hash value.

command prompt
command prompt

2. How to get the hash value in PowerShell

To get the hash value, use the commandGet-FileHash"Use the.

There are five hash algorithms available:

  • MD5
  • SHA1
  • SHA256
  • SHA384
  • SHA512

How to write the command:

Get-FileHash "ファイルのフルパス" -Algorithm SHA256 | Format-List

*Please change the "SHA256" part to the algorithm you want to obtain.

If the file name you specify contains spaces, enclose it in double quotation marks ("").

Algorithm: Example of specifying SHA256

1.Start buttonRight-click > Terminal or Windows PowerShell.

2. Type the following command and press Enter:

Get-FileHash "C:\Users\test\Downloads\Win11_24H2_Japanese_x64.iso" -Algorithm SHA256 | Format-List

This will display the hash value.

Windows PowerShell
Windows PowerShell
If you found this article helpful, please share it on social media.

Person who wrote this article

Driven by questions arising from my daily PC use and the desire to "do more," I have been pursuing self-study in Windows since around 2008. I am sharing the "aha!" techniques and solutions I discovered through trial and error with the sole purpose of helping you in your PC life.

View profile

Comment:

To comment

[About submissions]
We welcome any questions or information regarding the content of the article.
However, please note that content unrelated to the purpose of the article, criticism of specific individuals or organizations, offensive language,Inappropriate wordsComments containing the above may be deleted or made private without notice at the discretion of the administrator.
Please note that spam may be automatically deleted by anti-spam measures.

CAPTCHA


table of contents