Last active
April 19, 2019 19:55
-
-
Save bogdangrigg/eb426920a1cce3c5811847c2da5fe387 to your computer and use it in GitHub Desktop.
base64 encode & decode
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
# encode | |
$Text = "Hidden secret!" | |
$Bytes = [System.Text.Encoding]::Unicode.GetBytes($Text) # or Unicode.GetBytes($Text), if Unicode is not needed | |
$EncodedText =[Convert]::ToBase64String($Bytes) | |
$EncodedText | |
# decode | |
$EncodedText = “SABpAGQAZABlAG4AIABzAGUAYwByAGUAdAAhAA==” | |
$DecodedText = [System.Text.Encoding]::Unicode.GetString([System.Convert]::FromBase64String($EncodedText)) | |
$DecodedText |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment