Go version of my old-crypto package, implemented with interfaces.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
adfgvx
caesar
chaocipher
cmd/old-crypto
nihilist
null
playfair
square
straddling
transposition
vic
wheatstone
.gitignore
.travis.yml
CONTRIBUTING.md
LICENSE
Makefile
README.md
crypto.go
crypto_test.go

README.md

cipher — Old paper & pencil ciphers in Go.

godoc license build Go Report Card

cipher is a Go port of my old-crypto Ruby code.

It features a simple CLI-based tool called old-crypto which serve both as a collection of use-cases for the library and an easy way to use it.

Work in progress, still incomplete

Table of content

Features

It currently implement a few of the Ruby code, namely:

  • null
  • Caesar (you can choose the shift number)
  • Playfair
  • Chaocipher
  • Simple transposition (can be used with other ciphers as super-encipherement)
  • Polybius square bigrammatic cipher (for ADFGVX = polybius + transposition)
  • ADFGVX (6x6 square including numbers)
  • Straddling Checkerboard (for the Nihilist cipher)
  • Nihilist cipher (transposition as super-encipherment)
  • Wheatstone cipher system

It does not try to reinvent the wheel and implements the cipher.Block interface defined in the Go standard library (see src/crypto/cipher/cipher.go).

That means that all ciphers have BlockSize(), Encrypt() & Decrypt(). You can create one with NewCipher() then use Encrypt()/Decrypt. BlockSize() is of course implemented as well otherwise the interface would not be matched.

Installation

Like many Go-based tools, installation is very easy

go get github.com/keltia/cipher/cmd/...

or

git clone https://github.com/keltia/cipher
make install

The library is fetched, compiled and installed in whichever directory is specified by $GOPATH. The old-crypto binary will also be installed (on windows, this will be called old-crypto.exe).

To run the tests, you will need:

  • github.com/stretchr/assert

NOTE: please use and test the Windows version (use make windowsto generate it). It should work but I lack resources to play much with it.

Benchmarks

I tried to provide benchmarks for all ciphers (including key scheduling/expansion) and in some cases several implementations (and associated benchamarks).

TODO

  • more ciphers
  • more tests (and better ones!)
  • better display of results
  • refactoring to reduce code duplication: always in progress
  • even more tests

Contributing

Please see CONTRIBUTING.md for some simple rules.