Sample code for 30+ languages & platforms
PowerShell

Obfuscate String

Demonstrates how to obfuscate and unobfuscate a string.

Chilkat PowerShell Downloads

PowerShell
Add-Type -Path "C:\chilkat\ChilkatDotNet47-x64\ChilkatDotNet47.dll"

$success = $false

$sb = New-Object Chilkat.StringBuilder

$s = "Hello World!"

$sb.Append($s)
$($sb.GetAsString())

# Output is "Hello World!";

# Obfuscate the string.
# This is NOT encryption.  It's just a simple obfuscation.
$sb.Obfuscate()
$($sb.GetAsString())

# Output is 2GsgGhbSQVyG8Vb9

# -------------------------
# Unobfuscate.
$sb2 = New-Object Chilkat.StringBuilder
$s2 = "2GsgGhbSQVyG8Vb9"
$sb2.Append($s2)
$sb2.Unobfuscate()

$($sb2.GetAsString())

# Output is "Hello World!";