Skip to content

Instantly share code, notes, and snippets.

@SmugZombie
Created June 8, 2019 23:39
Show Gist options
  • Select an option

  • Save SmugZombie/d0daa02bdd81f346bf13eb446b66dede to your computer and use it in GitHub Desktop.

Select an option

Save SmugZombie/d0daa02bdd81f346bf13eb446b66dede to your computer and use it in GitHub Desktop.
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#Include, WinRun.ahk
# Base64 String Handling Taking Advantage of Powershell
# Ron Egli - Github.com/SmugZombie
clipboard := base64_encode("TestMessage")
msgbox, % base64_encode("TestMessage")
msgbox, % base64_decode(clipboard)
return
base64_encode(string){
command = powershell.exe -C "echo ([Convert]::ToBase64String([System.Text.Encoding]::Unicode.GetBytes(\"%string%\")))"
result := CmdRun(command)
StringReplace,result,result,`n,,,A
StringReplace,result,result,`r,,,A
return result
}
base64_decode(string){
command = powershell.exe -C "echo ([System.Text.Encoding]::Unicode.GetString([System.Convert]::FromBase64String(\"%string%\")))"
result := CmdRun(command)
StringReplace,result,result,`n,,,A
StringReplace,result,result,`r,,,A
return result
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment