Privacy and Security Add "Hash value" to Context Menu of Files in Windows 11


Hash_banner.png

This tutorial will show you how to add "Hash value" to the context menu of files for all users in Windows 10 and Windows 11.

The Hash value context menu allows you to get the SHA1, SHA256, SHA384, SHA512, MACTripleDES, MD5, and/or RIPEMD160 hash values (checksum) of files.

The Hash value context menu uses the Get-FileHash cmdlet in PowerShell to compute the hash value for a file by using a specified hash algorithm. A hash value is a unique value that corresponds to the content of the file. Rather than identifying the contents of a file by its file name, extension, or other designation, a hash assigns a unique value to the contents of a file. File names and extensions can be changed without altering the content of the file, and without changing the hash value. Similarly, the file's content can be changed without changing the name or extension. However, changing even a single character in the contents of a file changes the hash value of the file.

The purpose of hash values is to provide a cryptographically-secure way to verify that the contents of a file have not been changed. While some hash algorithms, including MD5 and SHA1, are no longer considered secure against attack, the goal of a secure hash algorithm is to render it impossible to change the contents of a file -- either by accident, or by malicious or unauthorized attempt -- and maintain the same hash value. You can also use hash values to determine if two different files have exactly the same content. If the hash values of two files are identical, the contents of the files are also identical.

Reference:

While you must be signed in as an administrator to add or remove this context menu, all users can use the context menu.



EXAMPLE: "Hash value" context menu

In Windows 11, you will need to click/tap on Show more options first by default, then click/tap on Hash value.


Show_more_options.png
Hash_value_context_menu.png

Show_all_hash_values.png



Here's How:

1 Do step 2 (add) or step 3 (remove) below for what you want.

2 Add "Hash value" to Context Menu

A) Click/tap on the Download button below to download the file below, and go to step 4 below.​

Add_Hash_value_to_context_menu.reg


(Contents of .reg file)
Code:
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\*\shell\hash]
"MUIVerb"="Hash value"
"subCommands"=""


; MD5
[HKEY_CLASSES_ROOT\*\shell\hash\shell\01menu]
"MUIVerb"="MD5"

[HKEY_CLASSES_ROOT\*\shell\hash\shell\01menu\command]
@="cmd /c echo \\\"%1\\\" | powershell -nop $file=[string]$input; get-filehash -literalpath $file.substring(2,$file.length - 5) -algorithm MD5 ^| format-list; Start-Sleep 3600"


; SHA1
[HKEY_CLASSES_ROOT\*\shell\hash\shell\02menu]
"MUIVerb"="SHA1"

[HKEY_CLASSES_ROOT\*\shell\hash\shell\02menu\command]
@="cmd /c echo \\\"%1\\\" | powershell -nop $file=[string]$input; get-filehash -literalpath $file.substring(2,$file.length - 5) -algorithm SHA1 ^| format-list; Start-Sleep 3600"


; SHA256
[HKEY_CLASSES_ROOT\*\shell\hash\shell\03menu]
"MUIVerb"="SHA256"

[HKEY_CLASSES_ROOT\*\shell\hash\shell\03menu\command]
@="cmd /c echo \\\"%1\\\" | powershell -nop $file=[string]$input; get-filehash -literalpath $file.substring(2,$file.length - 5) -algorithm SHA256 ^| format-list; Start-Sleep 3600"


; SHA384
[HKEY_CLASSES_ROOT\*\shell\hash\shell\04menu]
"MUIVerb"="SHA384"

[HKEY_CLASSES_ROOT\*\shell\hash\shell\04menu\command]
@="cmd /c echo \\\"%1\\\" | powershell -nop $file=[string]$input; get-filehash -literalpath $file.substring(2,$file.length - 5) -algorithm SHA384 ^| format-list; Start-Sleep 3600"


; SHA512
[HKEY_CLASSES_ROOT\*\shell\hash\shell\05menu]
"MUIVerb"="SHA512"

[HKEY_CLASSES_ROOT\*\shell\hash\shell\05menu\command]
@="cmd /c echo \\\"%1\\\" | powershell -nop $file=[string]$input; get-filehash -literalpath $file.substring(2,$file.length - 5) -algorithm SHA512 ^| format-list; Start-Sleep 3600"


; MACTripleDES
[HKEY_CLASSES_ROOT\*\shell\hash\shell\06menu]
"MUIVerb"="MACTripleDES"

[HKEY_CLASSES_ROOT\*\shell\hash\shell\06menu\command]
@="cmd /c echo \\\"%1\\\" | powershell -nop $file=[string]$input; get-filehash -literalpath $file.substring(2,$file.length - 5) -algorithm MACTripleDES ^| format-list; Start-Sleep 3600"


; RIPEMD160
[HKEY_CLASSES_ROOT\*\shell\hash\shell\07menu]
"MUIVerb"="RIPEMD160"

[HKEY_CLASSES_ROOT\*\shell\hash\shell\07menu\command]
@="cmd /c echo \\\"%1\\\" | powershell -nop $file=[string]$input; get-filehash -literalpath $file.substring(2,$file.length - 5) -algorithm RIPEMD160 ^| format-list; Start-Sleep 3600"


; Allget-filehash -literalpath '%1' -algorithm RIPEMD160 | format-list
[HKEY_CLASSES_ROOT\*\shell\hash\shell\08menu]
"CommandFlags"=dword:00000020
"MUIVerb"="Show all"

[HKEY_CLASSES_ROOT\*\shell\hash\shell\08menu\command]
@="cmd /c echo \\\"%1\\\" | powershell -nop $raw=[string]$input; $file=$raw.substring(2,$raw.length - 5); \\\"Path:`n$file`n\\\"; @(foreach ($a in @('MD5','SHA1','SHA256','SHA384','SHA512','MACTripleDES','RIPEMD160')) { get-filehash -literalpath $file -algorithm $a }) ^| foreach { \\\"$($_.Algorithm):`n$($_.Hash)`n\\\" }; Start-Sleep 3600"

3 Remove "Hash value" from Context Menu

This is the default setting.


A) Click/tap on the Download button below to download the file below, and go to step 4 below.​

Remove_Hash_value_from_context_menu.reg


(Contents of .reg file)
Code:
Windows Registry Editor Version 5.00

[-HKEY_CLASSES_ROOT\*\shell\hash]

4 Save the .reg file to your desktop.

5 Double click/tap on the downloaded .reg file to merge it.

6 When prompted, click/tap on Run, Yes (UAC), Yes, and OK to approve the merge.

7 You can now delete the downloaded .reg file if you like.


That's it,
Shawn Brink
 

Attachments

Last edited:
You could also do this with just powershell and no infinite loop
Powershell:
powershell.exe -noprofile -noexit -Command "& {Get-FileHash -LiteralPath %1 -Algorithm MD5 | fl Path,Algorithm,Hash}"
 

My Computer

System One

  • OS
    Windows 11

Latest Support Threads

Back
Top Bottom