12

Being very new to C++ and cryptography, I finally managed to implement a version of the Vinegere algorithm. I would like to try something a bit more complicated. I have looked at AES and DES and others like them, but I was wondering if there is something simpler. Something that might use some of the same basic ideas as AES, but is much simpler. Some kind of block cipher maybe?

So I am asking for suggestions for a block cipher that is much simpler than AES, but more complex than a basic substitution algorithm. I have by the way looked into the method used in the Enigma-machines, but from what I understand they do "basically" the same as Vigenere.

Paŭlo Ebermann
  • 22,946
  • 7
  • 82
  • 119
Thomas
  • 1,184
  • 5
  • 16
  • 33

5 Answers5

7

As Thomas mentions, Threefish (especially Threefish-256) is reasonably straightforward to implement and has an excellent specification (and if you grab the Skein 1.3 SHA-3 submission, comprehensive test vectors with intermediate states to help debug the implementation as you go).

One of the Speck family of block ciphers (published by the NSA in The SIMON and SPECK Families of Lightweight Block Ciphers) would also be a good starting point - they're similar to Threefish in design approach, but simpler to implement, and the specification is well written (with good diagrams and pseudocode). Obviously given the newness of Speck, and its provenance I'd strongly suggest these are implemented as an exercise only.

There are a bunch of Speck variants (differing in block size and key size), so I'd recommend to pick one of the smaller ones to start with. Test vectors are a little light, and the spec is ambiguous about byte sequencing in input/output blocks, but you can use my Java implementation to test against or generate intermediate states to help debug.

archie
  • 1,998
  • 17
  • 28
7

A simple block cipher would be Threefish (p. 11-13). It's a bit more complicated than RC4 or RC5 yet doesn't drive you insane with seemingly random design choices. It is presumably secure and was designed by experts but has not yet been reviewed extensively, so it shouldn't be used in sensitive applications yet (consider it an exercise).

You'll be able to implement the key schedule and the encryption/decryption functions, and if you use the PDF I linked above, it will be an excellent exercise in following a specification.

If anything, it's the technical details surrounding the implementations that can take you forever to fix, such as endianness concerns in particular (this isn't too much of a hassle for block ciphers but it did get in my way a few times when implementing hash functions).

PS: same name lol

Thomas
  • 7,568
  • 1
  • 32
  • 45
6

I think that a stream cipher would be the natural progression from a Vinegère, (before moving onto a block cypher).

ARC4 (also known as ArcFour, or RC4) would be my choice and there are good argument for that made by Arnold Reinhold over on http://ciphersaber.gurus.org/

Mike Edward Moras
  • 18,161
  • 12
  • 87
  • 240
Alexx Roche
  • 179
  • 6
  • 11
6

There is a stream cipher called the Solitaire Cipher that is designed to be implemented by a human using only a deck of playing cards. It is very simple to memorize, use, and implement in code.

B-Con
  • 6,196
  • 1
  • 31
  • 45
2

If one looks for smallest code, Tweetcipher might be interesting. There have been no third-party cryptanalysis, but it looks (for me) secure enough for exercise purpose.

Dmitry Khovratovich
  • 5,737
  • 23
  • 25