Skip to content

Instantly share code, notes, and snippets.

@EricTurner3
Last active October 24, 2023 13:07
Show Gist options
  • Save EricTurner3/efb7c42c25ac6d0ade1a70efbdd4d402 to your computer and use it in GitHub Desktop.
Save EricTurner3/efb7c42c25ac6d0ade1a70efbdd4d402 to your computer and use it in GitHub Desktop.
PowerShell Get All Hashes of File (Get-FileHash)
<#
Get-FileHash Extended
Returns all hashes from the supported algorithms in one response
Allows filepath to be used directly from an argument or prompt after the script is ran
#>
param(
[string]$FilePath
)
# handle missing arg
if ($FilePath -eq $null -or $FilePath -eq "") {$FilePath = Read-Host "Drag and drop file here, or enter full filepath"}
# all algorithms here
$algorithms = "MD5","SHA1","SHA256","SHA384","SHA512","MACTripleDES","RIPEMD160"
%{
foreach ($alg in $algorithms){
Get-FileHash -Algorithm $alg -Path $FilePath;
}
} | Format-Table -Wrap -Property Algorithm, Hash
pause
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment