Skip to content

Instantly share code, notes, and snippets.

@h3nryza
Created July 17, 2018 17:31
Show Gist options
  • Select an option

  • Save h3nryza/67cb6f925c152a1489daab302c3c0e02 to your computer and use it in GitHub Desktop.

Select an option

Save h3nryza/67cb6f925c152a1489daab302c3c0e02 to your computer and use it in GitHub Desktop.
Powershell encryption decryption
Get-FileHash -Algorithm SHA1
Get-FileHash -Algorithm SHA256
Get-FileHash -Algorithm SHA384
Get-FileHash -Algorithm SHA512
Get-FileHash -Algorithm MACTripleDES
Get-FileHash -Algorithm MD5
Get-FileHash -Algorithm RIPEMD160
#PowerShell Password Encryption and Decryption
<#
$PlainPassword = "Password"
$SecurePassword = $PlainPassword | ConvertTo-SecureString -AsPlainText -Force
OR
$SecurePassword = Read-Host -Prompt "Enter password" -AsSecureString
OR
$SecurePassword = (Get-Credential).password | Convertfrom-SecureString
#>
$SecurePassword = (Get-Credential).password | Convertfrom-SecureString
$SecurePassword |out-file c:\temp\SecurePassword.txt
$SecurePassword=c:\temp\SecurePassword.txt | Convertto-SecureString
$BSTR= [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($SecurePassword)
$Password=[System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment