cencryptionstream-cipher

C Symmetric Stream Cipher


Does anyone have a good implementation of a stream cipher written in pure portable C? I am not terribly concerned with the strength of the cipher at this point in time because it is only for a proof of concept, but speed would be important. I've thought about just Xor'ing with a constant if I cannot find a decent stream cipher.


Solution

  • EDIT (2018): use NaCl or libsodium, or TweetNaCl if you're looking for a smaller code footprint. They provide strong encryption and should be much faster than RC4.

    RC4 is a very simple algorithm to implement.

    Check out Sterling Camden's implementation or Adam Back's implementation.