Simplified DES (S-DES) file encryption implementation in C

Simplified DES

Simplified DES

This encryption algorithm is not secure at all, in fact it was made for educational purposes. It uses a 10-bit key that can be quickly broken by a brute force attack. But, who knows, it may be good for someone interested in some quick encryption where security is not that important, or for embedded devices were resources are limited, or just for lazy students. :D

So, here is my version of the S-DES algorithm in plain C. Differently from the other version in the web my implementation is more byte-oriented while the other (probably more didactic) is converting the input to a string with ’0′s and ’1′s and working over it. Also the other implementation uses some C++ functions while mine is written in plain C.

Download it and take a look to the code (it is less than 300 lines) — released under BSD license.

To build it with gcc type:

gcc sdes.c -lm -o sdes

Note that I’m using math library only because of the pow() function that is used only in debug mode.

And here is a copy of a document explaining the algorithm.

Image source

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>