Skip to content

Instantly share code, notes, and snippets.

@R41D3NN
Created June 16, 2018 00:25
Show Gist options
  • Save R41D3NN/61b0b1028e6351298be40c3ed0147902 to your computer and use it in GitHub Desktop.
Save R41D3NN/61b0b1028e6351298be40c3ed0147902 to your computer and use it in GitHub Desktop.
Converts base64 strings.
Function Convert-ToBase64String
{
Param(
[String] $Text
)
$Local:Bytes = [System.Text.Encoding]::Unicode.GetBytes($Text)
$Local:EncodedText = [Convert]::ToBase64String($Local:Bytes)
Return $Local:EncodedText
}
Function Convert-FromBase64String
{
Param(
[String] $Base64Text
)
$Local:DecodedText = [System.Text.Encoding]::Unicode.GetString([System.Convert]::FromBase64String($Base64Text))
Return $Local:DecodedText
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment