Created
July 17, 2018 17:31
-
-
Save h3nryza/67cb6f925c152a1489daab302c3c0e02 to your computer and use it in GitHub Desktop.
Powershell encryption decryption
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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