Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Base64 encoding and decoding oneliner (powershell)
#1
Encode:
[convert]::ToBase64String([system.text.encoding]::UTF8.getbytes("STRING"))
Decode:
[system.text.encoding]::UTF8.getstring([convert]::FromBase64String("BASE64STRING"))

function for profile:

function b64 {
Param (
[switch]$e,
[switch]$d,
[string]$string
)

if ($e) {
[convert]::ToBase64String([system.text.encoding]::UTF8.getbytes($string))
}
if ($d) {
[system.text.encoding]::UTF8.getstring([convert]::FromBase64String($string))
}
}



example:
b64 -e "Hello World"
output:
SGVsbG8gV29ybGQ=
Reply


Messages In This Thread
Base64 encoding and decoding oneliner (powershell) - by Ktp - 06-06-2022, 02:30 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)