Coder Social home page Coder Social logo

markovtextstego.js's Introduction

markovTextStego.js

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.

An online interactive demo is available here.

Installation

<script src="markovTextStego.js"></script>

Usage

Initial setup:

var stego = new MarkovTextStego();

Create n-gram model:

var model = new stego.NGramModel(n);

// Import corpus (an array of strings: messages, lines, paragraphs, etc.)
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);

Limitations

  • Corpus must contain at least two unique sentences/lines with each consisting of two or more words.

Acknowledgements

Licence

MIT

markovtextstego.js's People

Contributors

jthuraisamy avatar

Stargazers

MARCOUX avatar FooLzilla The Drilla avatar  avatar 5l1v3r1 avatar y.kankaya avatar RPN68 avatar TheGreatRambler avatar Chris Ellis avatar  avatar Aaron avatar Riceball LEE avatar Mahafuzur Rahman avatar Houssam Haidar avatar Alec avatar bryfry avatar Liam Ronan avatar Tema Smirnov avatar George-Bogdan Ivanov avatar Muhammad Nasrurrohman avatar Ho avatar Yuya Jeremy Ong avatar Hernan Moraldo avatar  avatar

Watchers

Hernan Moraldo avatar  avatar Umair Idris avatar Sam Havens avatar  avatar  avatar

markovtextstego.js's Issues

Can't handle non-ASCII cover text

First of all, nice job. I've been looking for a good alternative to encoding encrypted strings as random words form a cover text, or sets of single and double spaces, which would still make some grammatical sense. The goal is to add it to the PassLok suite (also on GitHub).

I found that your library works quite well, except when the cover text ("corpus," I guess, in your nomenclature) contains non-ASCII characters, as when using a language that is not English (most European languages contain accented characters, for instance). The reason is that the matchPattern regex is too zealous removing those characters, and cuts whole words into pieces.

I've found some success putting this regex into line 13 of the library:

this.matchPattern = /[^'";:,.\/?!\-\s()]+/g;

which essentially removes punctuation only as the corpus is cut into words. I'm having trouble understanding your regex, so I'm sorry that I cannot take all nuances into account.

Decoding without corpus?

This is actually a request. I think it would be very nice if the program could make the word list from an encoded text, rather than needing a pristine copy of corpus to generate the codec. This way, recipients of an encoded message would be able to decode it much more easily.

Is this possible at all?

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.