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
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.
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 windows
to generate it). It should work but I lack resources to play much with it.
I tried to provide benchmarks for all ciphers (including key scheduling/expansion) and in some cases several implementations (and associated benchamarks).
- more ciphers
- more tests (and better ones!)
- better display of results
- refactoring to reduce code duplication: always in progress
- even more tests
Please see CONTRIBUTING.md for some simple rules.