Git Product home page Git Product logo

chaocipher's Introduction

ChaoCipher

ChaoCipher is a Ruby implementation of the Chaocipher cipher, invented by J. F. Byrne; the algorithm was disclosed in 2010, hence this small bit of code!

The Algorithm

You can find more about the Chaocipher at Wikipedia/Chaocipher, and you can read the online PDF which contains details about the algorithm itself, upon which this code is based. The algorithm isn't that involved and is actually quite rudimentary.

How do I use this thing?

To install from RubyGems:

gem install chaocipher

To get the source:

git clone https://github.com/aprescott/chaocipher.git

To run the tests with the source:

rake test

To contribute:

  • Fork it
  • Make a new feature branch: git checkout -b some-new-thing master
  • Hack away and add tests
  • Pull request

Basic usage

The Chaocipher works off two alphabets, a "left" and a "right" alphabet which are used for look-up during ciphering and deciphering. The initial two alphabets are all that is required to have a working cipher. For more details, it's probably best that you just read the PDF linked above.

require "chaocipher"

ciphertext_alphabet = "HXUCZVAMDSLKPEFJRIGTWOBNYQ"
plaintext_alphabet = "PTLNBQDEOYSFAVZKGJRIHWXUMC"

cipher = ChaoCipher::Cipher.new(ciphertext_alphabet, plaintext_alphabet)

cipher.encrypt("WELLDONEISBETTERTHANWELLSAID") #=> "OAHQHCNYNXTSZJRRHJBYHQKSOUJY"

Cryptographic security

I have no idea what the strength of this cipher is, so I wouldn't encrypt anything of utter importance with it, personally.

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.