Skip to content

Instantly share code, notes, and snippets.

@amandadebler
Created May 29, 2020 12:51
Show Gist options
  • Save amandadebler/84fbfe78d73343ca60953b17c4c0c6d6 to your computer and use it in GitHub Desktop.
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
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)
}
@amandadebler
Copy link
Author

Technique from Sean Metcalf: https://adsecurity.org/?p=478

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