Fork me on GitHub

markovTextStego.js by Jackson Thuraisamy

Text steganography library for JavaScript

Corpus Selection


Input Text


Output Text


About

This is a text steganography library for JavaScript adapted from Hernan Moraldo's reference implementation for “An Approach for Text Steganography Based on Markov Chains”. This method produces more natural looking and less easily detectable texts than other Markov-based systems. In this implementation, n-gram models support updating and n values of ≥ 1.

Acknowledgements:

  • Hernan Moraldo
  • Umair Idris

Usage

Initial setup:

var stego = new MarkovTextStego();

Create n-gram model:

var corpus = [...];
var model = new stego.NGramModel(n);
model.import(corpus);

Initialise the Codec:

var codec = new stego.Codec(model);

Encode / Decode:

codec.encode('Hello World!');
codec.decode('The Achaeans. And with a moderate force of which one has to remark that men ought either to the kingdom! In exchange for the priesthood? Were San Pietro ad Vincula. He was obliged to avoid one trouble without running into another but prudence consists in knowing how lukewarm he was priest and that those men who were besieging Gaeta. In charge of Messer Antonio the priest to the shoulders of the counsellors will think of himself.');

Update the model with an array of additional corpus text:

model.update(additionalCorpus);

Change the model to a different one:

codec.setModel(newModel);