Sample code for 30+ languages & platforms
Node.js

Obfuscate String

Demonstrates how to obfuscate and unobfuscate a string.

Chilkat Node.js Downloads

Node.js
NODEJS_PRELUDE

function chilkatExample() {

    var success = false;

    var sb = new chilkat.StringBuilder();

    var s = "Hello World!";

    sb.Append(s);
    console.log(sb.GetAsString());

    //  Output is "Hello World!";

    //  Obfuscate the string.
    //  This is NOT encryption.  It's just a simple obfuscation.
    sb.Obfuscate();
    console.log(sb.GetAsString());

    //  Output is 2GsgGhbSQVyG8Vb9

    //  -------------------------
    //  Unobfuscate.
    var sb2 = new chilkat.StringBuilder();
    var s2 = "2GsgGhbSQVyG8Vb9";
    sb2.Append(s2);
    sb2.Unobfuscate();

    console.log(sb2.GetAsString());

    //  Output is "Hello World!";

}

chilkatExample();