Sign up ×
Cryptography Stack Exchange is a question and answer site for software developers, mathematicians and others interested in cryptography. It's 100% free, no registration required.

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.

share|improve this question
Try TEA. It is simple, secure (except for related-key attacks, and limits inherent to its 64-bit block size), and acceptably fast for many uses. – fgrieu Jun 3 '12 at 19:15
If it doesn't have to be a block cipher, RC4 would be a good one to look at. – mikeazo Jun 3 '12 at 19:19
@fgrieu I'd recommend XTEA, it is as simple as TEA but, as far as we know, more secure. – Chris Smith Jun 4 '12 at 15:01
@ChrisSmith: Why would XTEA be more secure than TEA? Except for related-key attacks and the fact that each key trivially has 3 other equivalent keys, reducing TEA's key space to 126 bits, I know no weakness of TEA. On the other hand, a casual reading of Meet-in-the-Middle Attacks on Reduced-Round XTEA seems to indicate that XTEA has less security margin than TEA in both the single-key and related-key settings. Not all revisions/extensions are improvements, and I feel TEA is more time-tested than XTEA is. – fgrieu Jun 4 '12 at 19:40
@fgrieu thanks for the suggestion. This looks like exactly what I want. I have been reading in a book about the Feistel structure, the TEA looks like that. So that is probably a good place to start. – Thomas Jun 4 '12 at 23:15

5 Answers 5

up vote 6 down vote accepted

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

share|improve this answer
I'm curious as to what you meant when you said "it is a priori secure." – mikeazo Jun 7 '12 at 11:23
@mikeazo I meant that it's been designed by cryptography experts and has undergone some analysis. So we can expect it to be secure, however it would be wise to wait until the algorithm has undergone more extensive peer review (better be safe than sorry). Perhaps I should edit my answer to reflect that. – Thomas Jun 7 '12 at 11:47
Probably the only "a priori secure" function we have is a OTP. – Ethan Heilman Jul 3 '12 at 16:36
Bad choice of terms, I agree. I don't know why I wrote that. Make that "presumably". – Thomas Jul 3 '12 at 17:13
I found threefish easy enough to implement directly from the specification. It's fun to do, and you can compare with the reference implementation afterwards. The only tricky part (where the designers themselves went wrong) is taking care of the little endianness of the various values (up to 128 bit going the wrong way). – Maarten Bodewes Oct 29 '13 at 1:12

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

share|improve this answer
RC4 indeed. There's even a rumor that it's designed for soldiers to remember by head and implement whenever given a PC and directly use it to encrypt/decrypt messages. – Mark Jeronimus Oct 21 '14 at 21:00

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.

share|improve this answer

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.

share|improve this answer

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.

share|improve this answer
Simeck fits in one tweet (compared with Tweetciphers massive 6). It purports to be a combination of Simon and Speck and was presented at DIAC 2013 by Bo Zhu (slides are on his page), but I'm not sure if it's serious... – archie Oct 31 '13 at 7:39
@archie: Did you maybe mean to say that the SPECK128 cipher fits in one tweet ? – David Cary Mar 28 at 12:36
@archie: Did you maybe mean to link to the Simeck tweet on p. 23 of "Revisiting Counter Mode to Repair Galois/Counter Mode and Simeck: An Authenticated Cipher Design"? – David Cary Mar 28 at 21:04

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.