Skip to content

Instantly share code, notes, and snippets.

@WalternativE
Created March 28, 2017 07:18
Show Gist options
  • Save WalternativE/450b155c45f81b14290f8ded8324a283 to your computer and use it in GitHub Desktop.
Save WalternativE/450b155c45f81b14290f8ded8324a283 to your computer and use it in GitHub Desktop.
Powershell script that returns SHA-256 hash for a given string
Param (
[Parameter(Mandatory=$true)]
[string]
$ClearString
)
$hasher = [System.Security.Cryptography.HashAlgorithm]::Create('sha256')
$hash = $hasher.ComputeHash([System.Text.Encoding]::UTF8.GetBytes($ClearString))
$hashString = [System.BitConverter]::ToString($hash)
$hashString.Replace('-', '')
@DerrickAttfield
Copy link

Thank you - very cool! saved me much time!

@WalternativE
Copy link
Author

Thank you - very cool! saved me much time!

Glad that it helped you 😊

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