Skip to content

Instantly share code, notes, and snippets.

@itpropro
Last active October 29, 2016 00:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save itpropro/64eff74c9654ebf8aff0 to your computer and use it in GitHub Desktop.
Save itpropro/64eff74c9654ebf8aff0 to your computer and use it in GitHub Desktop.
# MD5 for String
$hash = [System.Security.Cryptography.MD5]::Create()
$byte = [System.Text.Encoding]::UTF8.GetBytes('Test')
$md5 = $hash.ComputeHash($byte)
([Bitconverter]::ToString($md5)).replace('-','')
# MD5 for File
$hash = [System.Security.Cryptography.MD5]::Create()
$file = [System.IO.File]::ReadAllBytes('E:\Onedrive\Dokumente\Skripte\Powershell Skripte\test.zip')
$md5 = $hash.ComputeHash($file)
([Bitconverter]::ToString($md5)).replace('-','')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment