Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 218
Steven Behnke Avatar asked Dec 22 '08 19:12

Steven Behnke


2 Answers

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.

like image 79
orip Avatar answered Sep 24 '22 08:09

orip


See the ECRYPT eStream project. These are serious hardcore cryptographic algorithms judged by security experts. As far as I know all the candidate algorithms were required to include an implementation in pure C (not C++).

edit: The great thing about that website is it goes into a lot of depth about the different algorithms, including their known weaknesses, and includes performance benchmarks as well.

like image 44
Jason S Avatar answered Sep 22 '22 08:09

Jason S