Guest User

Untitled

a guest
Mar 17th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. #converts string to MD5 hash in hyphenated and uppercase format
  2.  
  3. $someString = "test"
  4. $md5 = new-object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider
  5. $utf8 = new-object -TypeName System.Text.UTF8Encoding
  6. $hash = [System.BitConverter]::ToString($md5.ComputeHash($utf8.GetBytes($someString)))
  7.  
  8. #to remove hyphens and downcase letters add:
  9. $hash = $hash.ToLower() -replace '-', ''
Add Comment
Please, Sign In to add comment