Skip to content

Instantly share code, notes, and snippets.

@dalton-cole
Created July 28, 2014 15:13
Show Gist options
  • Save dalton-cole/4b9b77db108c554999eb to your computer and use it in GitHub Desktop.
Save dalton-cole/4b9b77db108c554999eb to your computer and use it in GitHub Desktop.
PowerShell text to MD5 hash
#converts string to MD5 hash in hyphenated and uppercase format
$someString = "test"
$md5 = new-object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider
$utf8 = new-object -TypeName System.Text.UTF8Encoding
$hash = [System.BitConverter]::ToString($md5.ComputeHash($utf8.GetBytes($someString)))
#to remove hyphens and downcase letters add:
$hash = $hash.ToLower() -replace '-', ''
@jamesmuldrow
Copy link

thanks

@webdezy
Copy link

webdezy commented Mar 14, 2020

Thanks!

@shubhamcloud9
Copy link

Thanks man!

@rbleattler
Copy link

Useful reference. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment