Sarah2 Cipher
laser-calcium.glitch.me
laser-calcium.glitch.me
Second, the whole encryption is modeled on a series of identical encryption rounds (no per-round subkeying). I would not be surprised if this structure makes it vulnerable to a slide attack - which is an attack that specifically attacks weak round functions no matter how many times they are iterated.
Although I haven’t spent enough time to be certain these attacks will work, the design of the cipher does not inspire confidence. The cipher achieves poor diffusion after log2(n) rounds on highly repetitive text (e.g. “a” repeated 16 times yields “rjrjmlmlskskjbjb” after log2(n)-1=3 rounds), meaning that the minimum round count feels entirely too low to be safe.
I don't know if it's just assumed or if was an actual oversight on the part of the author, but I found it strange that there is no mention of the Vigenere cipher which the first step greatly resembles.
I also was confused why they referred to transposition as permutation... and why the last round of transposition is optional "because it's so trivial".
My understanding of things is that if it's so trivial you can leave it out, then it's not really adding much security in the first place.
I’m pretty suspicious of this approach for long messages, where you’ll have ECB-like problems—too many pairs that will survive the transpositions.
I’m pretty suspicious of this for short messages because there’s no randomness.
I like designs like this just as teaching models (which I think was part of the point of designing it). Slide attacks, which I've never played with before, are really neat; my attempt to distill the idea is that, in ciphers with repeating round/key structure, by hunting for pairs P=F(P'), you can effectively reveal a single iteration of the round function. In designs like this, iteration is meant to shield the weak round function from attack; the slide attack collapses security back down to a single application of the round.
Despite the large key size and the reasonable block size of 128 bits, a slide attack can defeat it in less than 4096 plaintext-ciphertext pairs, demonstrating the devastating effectiveness of this approach. Every block cipher since has featured some kind of per-round keying or variance to ward off this attack.
Certainly, I wouldn't want to make the case that you should use this toy cipher (but I don't know that its author is making that case either, since they too use the word "toy" to describe it). I'm saying: simple flawed ciphers are extremely useful just as a model for learning how to actually code attacks.
Some of the latest crypto-heavy CTFs have also featured pretty sophisticated "fundamental" attacks on ciphers. I've seen attacks on custom LCG-based stream ciphers (Google CTF), fancy math attacks on RSA variants (hxp 36C3 CTF just last week), and even the odd differential attack. Good crypto CTF challenges are really interesting and are great opportunities to learn and build classic attacks :)
Last time I looked into this, the consensus seemed to be that even random S-boxes are likely to be good, or at least "good enough." And that it's actually not that hard to filter out boxes that are likely to be bad.
I don't have references handy but google gets me this, for instance: https://kste.dk/assets/slides/secretsbox.pdf
Larger S-Boxes might be better; Blowfish for example uses larger key-dependent S-Boxes and yet seems to be reasonably secure. However, they’re also used in conjunction with per-round subkeys; I don’t know how Sarah2 would fare without these per-round keys.
- The key is huge and really unwieldy. Disguising it (for subtle key distribution) could be hard. Solitaire here has a bit of a better story (nobody looks twice at a pack of cards), but in general a good key-derivation function could help. (A bad key derivation function could totally compromise this scheme - which is why it’d be good to specify one!)
- There’s no specifies incremental mode of operation (which is a useful property), which means that you’d have to manually break your ciphertext into blocks. It’d be good to specify an optimal block size.
- The creator claims in other places (e.g. Reddit) that certain types of attacks don’t apply because this is a hand cipher. However a hand cipher doesn’t mean that both parties must be operating the cipher by hand! It seems like a common use-case would be for one party to have access to technology (e.g. a spymaster), in which case a bug could enable automated attacks on the system.
What I do like about this cipher is the conceptual simplicity; I’m just bothered by the claim that it is a “strong” cipher without convincing evidence of that being true.
(I haven't though this through carefully, just spitballing).
* https://news.ycombinator.com/item?id=16586257
* http://scienceblogs.de/klausis-krypto-kolumne/2018/05/14/the...
And a tweaked version thereof, LS47:
* https://gitea.blesmrt.net/exa/ls47
* https://weekly-geekly.github.io/articles/352448/index.html
https://www.reddit.com/r/crypto/comments/ea00yb/sarah2_a_str...
and this one on Lobsters from a day or two ago:
I may have missed it, but there appears to be no instructions on how to decrypt?
"Sarah2 is a cipher meant to be implemented by hand with only simple tools."