(DataFlex) Obfuscate String
Demonstrates how to obfuscate and unobfuscate a string.
Use ChilkatAx-win32.pkg
Procedure Test
Handle hoSb
Boolean iSuccess
String s
2 Handle hoSb2
String sS2
String sTemp1
Get Create (RefClass(cComChilkatStringBuilder)) To hoSb
If (Not(IsComObjectCreated(hoSb))) Begin
Send CreateComObject of hoSb
End
Move "Hello World!" To s
Get ComAppend Of hoSb s To iSuccess
Get ComGetAsString Of hoSb To sTemp1
Showln sTemp1
// Output is "Hello World!";
// Obfuscate the string.
// This is NOT encryption. It's just a simple obfuscation.
Send ComObfuscate To hoSb
Get ComGetAsString Of hoSb To sTemp1
Showln sTemp1
// Output is 2GsgGhbSQVyG8Vb9
// -------------------------
// Unobfuscate.
Get Create (RefClass(cComChilkatStringBuilder)) To hoSb2
If (Not(IsComObjectCreated(hoSb2))) Begin
Send CreateComObject of hoSb2
End
Move "2GsgGhbSQVyG8Vb9" To sS2
Get ComAppend Of hoSb2 sS2 To iSuccess
Send ComUnobfuscate To hoSb2
Get ComGetAsString Of hoSb2 To sTemp1
Showln sTemp1
// Output is "Hello World!";
End_Procedure
|