Sample code for 30+ languages & platforms
React Native

Obfuscate String

Demonstrates how to obfuscate and unobfuscate a string.

Chilkat React Native Downloads

React Native
import { StringBuilder } from '@chilkat/react-native'

function chilkatExample() {
  const sb = new StringBuilder();

  const 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.
  const sb2 = new StringBuilder();
  const s2 = '2GsgGhbSQVyG8Vb9';
  sb2.append(s2);
  sb2.unobfuscate();

  console.log(sb2.getAsString());

  // Output is "Hello World!";
}