5 ms·
Just in case anyone is tempted to actually use this and hasn't gotten the memo: RC4 is broken and has been for some time now.
by lisper 11y ago
Just in case anyone is tempted to actually use this and hasn't gotten the memo: RC4 is broken and has been for some time now.
- nothrabannosir 11y agoAny comment on this? Is RC4 secure? For this use-case, yes. For TLS, most certainly not. Even today there are many plausible attacks against RC4 in the TLS context, but none of them apply to this static-data world.
- aidenn0 11y agoRC4 is no longer considered secure for most any purpose. There is known bias in the first few bytes of the cipher that can allow for key-recovery with enough messages sent with the same key. In general you want "head room" in your ciphers such that the best attacks today are not just impractical, but wildly impractical, because attacks tend to get better over time. RC4 was known to not have this "head room" for a while, and now is largely broken.
- kybernetikos 11y ago"This use-case" indicates to me a single message encrypted with a single passphrase.
- tptacek 11y agoThere are biases throughout the whole RC4 keystream, not just in the first few bytes. RC4 is totally broken.
- ultramancool 11y agoIf you cannot have something continue to produce output though those periodic biases cannot be obtained, To my knowledge you need a quite large amount of output to exploit them. So for encrypting a single short message, where an attacker is unable to obtain more output, this should be sufficient for such a purpose. Still, I wouldn't use it at all, there are other micro alternatives like TweetNaCl which offer a far higher degree of security.
- aidenn0 11y ago> So for encrypting a single short message, where an attacker is unable to obtain more output, this should be sufficient for such a purpose. This is fairly vacuous as there are tons of really broken cryptosystems for which this is true; futhermore if you are going to only send a single short message with a given key, an OTP could probably be described in 140 characters of English prose and requires no machine to implement.
- tptacek 11y agoIt's not vacuous, but there is a history of cryptosystems that have tried and failed to sidestep that RC4 weakness by burning off keystream, so it's worth being careful about it.
- mikeash 11y agoLet's say you wanted to implement a more modern, not (yet?) broken algorithm instead of RC4. Are there any which could fit into a similarly small amount of code?
- swiley 11y agoRSA is pretty short (just modular exponentiation). The problem is all the stuff that goes around it: key generation, padding etc.
- JoachimSchipper 11y agoWith Intel's instructions, AES-GCM is decently short. ;-)
- mikeash 11y agoThat is both hilarious and practical.
- Rebelgecko 11y agoMaybe not quite that small, but if you look up some "lightweight block ciphers", you can find some candidates.
- lisper 11y agoI like TEA (or XTEA or XXTEA). Not quite as small as RC4 but still pretty compact. https://en.wikipedia.org/wiki/Tiny_Encryption_Algorithm https://en.wikipedia.org/wiki/Tiny_Encryption_Algorithm
- hatsunearu 11y agohttps://en.wikipedia.org/wiki/Speck_%28cipher%29 https://en.wikipedia.org/wiki/Speck_%28cipher%29 Speck's pretty nice and tiny, but who knows if it's backdoored or not :)
- mikeash 11y agoThat is a pretty sweet reference implementation. Thanks for the link.