Giter VIP home page Giter VIP logo

cryptogram's Introduction

cryptogram

cryptogram puzzle solver helper script for node.js

Installation

npm install [-g] cryptogram

Usage

CLI

Think of this like tr(1) specifically for solving encoded messages

$ cat puzzle.txt
ozwe we t eikdio rbd ozi kdxyobvdta hbsi ue absgmi zimyid absgmi.

Knowing that kdxyobvdta is cryptogram, we can run

$ cat puzzle.txt | cryptogram kdxyobvdta cryptogram
t*** ** a **cr*t *or t** cryptogram *o** ** mo**** ***p*r mo****.

Then solving it becomes a matter of testing it out letter by letter to uncover more of the meaning.

If a first word or clue is not known, you'll have to invoke a more brute-force method by:

  1. finding the longest word
  2. testing all words of that length using -w for a word list

Since kdxyobvdta is the longest word at 10 characters, compile a dictionary and test it:

$ awk 'length($0) == 10' /usr/share/dict/words > 10-letter-words.txt
$ cat puzzle.txt | cryptogram -w 10-letter-words.txt kdxyobvdta
"kdxyobvdta" => "gonimolobe"
m*** ** b **go*m *oo m** gonimolobe *o** ** eo**** ***i*o eo****.

"kdxyobvdta" => "gonotokont"
t*** ** n **go*t *oo t** gonotokont *o** ** to**** ***o*o to****.

"kdxyobvdta" => "gopherroot"
e*** ** o **go*e *ro e** gopherroot *r** ** tr**** ***h*o tr****.
...

Then just sift through this list looking for words that are "most likely" to match.

API

cryptogram(message, from, to, opts = {})

var cryptogram = require('cryptogram');
var message = 'ozwe we t eikdio rbd ozi kdxyobvdta hbsi ue absgmi zimyid absgmi.';

var decoded = cryptogram(message, 'kdxyobvdta', 'cryptogram');
console.log(decoded);
// => "t*** ** n **go*t *oo t** gonotokont *o** ** to**** ***o*o to****."
  • opts.character - character used for unknowns, defaults to *

License

MIT License

cryptogram's People

Contributors

bahamas10 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

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.