PowerShell Hashing

Simply so I know where to find this easily, next time I need it…

$hash_me = "Hello World"

$hash_bytes = [System.Security.Cryptography.HashAlgorithm]::Create("SHA256").ComputeHash([System.Text.Encoding]::UTF8.GetBytes($hash_me))

$hash_bytes | Format-Hex

[Convert]::ToBase64String($hash_bytes)

But don’t use it for storing passwords!

Leave a Reply

Your email address will not be published. Required fields are marked *