Created
May 29, 2020 12:51
-
-
Save amandadebler/84fbfe78d73343ca60953b17c4c0c6d6 to your computer and use it in GitHub Desktop.
Convert to and from Base64, since there's no built-in Windows command for this
This file contains 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
function ConvertTo-Base64 { | |
Param( | |
$Text | |
) | |
$Bytes = [System.Text.Encoding]::Unicode.GetBytes($Text) | |
[System.Convert]::ToBase64String($Bytes) | |
} | |
function ConvertFrom-Base64 { | |
Param( | |
$EncodedText | |
) | |
$DecodedBytes = [System.Convert]::FromBase64String($EncodedText) | |
[System.Text.Encoding]::Unicode.GetString($DecodedBytes) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Technique from Sean Metcalf: https://adsecurity.org/?p=478