06-06-2022, 02:30 PM
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=
[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=