Hashing in Windows


Hashing in Windows

Powershell

File

Get-FileHash -Algorithm (MD5 | SHA1 | SHA256 | SHA384| SHA512) -LiteralPath DVD.iso

Text

$text = 'test text'

$memoryStream = [System.IO.MemoryStream]::new()
$streamWriter = [System.IO.StreamWriter]::new($MemoryStream)
$streamWriter.Write($text)
$streamWriter.Flush()
$memoryStream.Position = 0
$hash = Get-FileHash -InputStream $MemoryStream -Algorithm 'SHA512' 
$memoryStream.Dispose()
$streamWriter.Dispose()
$hash.Hash

Command

File

certutil.exe -hashfile c:\temp\dvd.iso ( md5 | sha1 | sha256 | sha384 | sha512 )
  • https://docs.microsoft.com/en-us/dotnet/api/microsoft.powershell.commands.getfilehashcommand?view=powershellsdk-7.0.0&viewFallbackFrom=pscore-6.0.0
, ,