Skip to content

Instantly share code, notes, and snippets.

@ardislu
Last active December 11, 2021 23:38
Show Gist options
  • Save ardislu/1e258716c71c4712b693f17a0dc57180 to your computer and use it in GitHub Desktop.
Save ardislu/1e258716c71c4712b693f17a0dc57180 to your computer and use it in GitHub Desktop.
Powershell script to hash a string.
# December 2021 update: this gist is not maintained.
# View the latest version of this function in my module: https://github.com/ardislu/ArdisUtilities
Param(
[string]$Value = '',
[string]$Algorithm = 'SHA1'
)
$stream = [System.IO.MemoryStream]::new([byte[]][char[]]$Value)
Get-FileHash -InputStream $stream -Algorithm $Algorithm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment