(VBScript) Obfuscate String
Demonstrates how to obfuscate and unobfuscate a string.
Dim fso, outFile
Set fso = CreateObject("Scripting.FileSystemObject")
'Create a Unicode (utf-16) output text file.
Set outFile = fso.CreateTextFile("output.txt", True, True)
' For versions of Chilkat < 10.0.0, use CreateObject("Chilkat_9_5_0.StringBuilder")
set sb = CreateObject("Chilkat.StringBuilder")
s = "Hello World!"
success = sb.Append(s)
outFile.WriteLine(sb.GetAsString())
' Output is "Hello World!";
' Obfuscate the string.
' This is NOT encryption. It's just a simple obfuscation.
sb.Obfuscate
outFile.WriteLine(sb.GetAsString())
' Output is 2GsgGhbSQVyG8Vb9
' -------------------------
' Unobfuscate.
' For versions of Chilkat < 10.0.0, use CreateObject("Chilkat_9_5_0.StringBuilder")
set sb2 = CreateObject("Chilkat.StringBuilder")
s2 = "2GsgGhbSQVyG8Vb9"
success = sb2.Append(s2)
sb2.Unobfuscate
outFile.WriteLine(sb2.GetAsString())
' Output is "Hello World!";
outFile.Close
|