Skip to content
/ cipher Public

Go version of my old-crypto package, implemented with interfaces.

License

Notifications You must be signed in to change notification settings

keltia/cipher

Repository files navigation

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.

About

Go version of my old-crypto package, implemented with interfaces.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published