Guys, if you are looking for an implementation of Simplified DES (SDES) using microcontroller then you are lucky if you see this page. Last night, i have tried to implement a simple encryption/decryption algorithm called Simplified DES (SDES) using PIC16F84 microcontroller. Its just a piece of cake, you can implement all of this while cutting nailðŸ™‚ . Its only 384 bytes of code.

Both of encrypting and decrypting process takes approximately 130 cycles of clock. But if you want to get faster, you just need to convert permutation process into lookup. It will takes larger memory but require less time. For example, you can can convert e/p permutation into 16 cells of lookup table. On the other hand Initial Permutation (IP) and Inverse Initial Permutation can also be done by converting each of them into 256 cells of lookup table. Surely, your application becoming memory hogg, but it going fasterðŸ™‚

Here are some screenshoot, i took it from My Own SDES Simulator and MPLAB 5.20

MPLAB 5.20

SDES Simulator

To test the code, i supplied “0x39” as plain text and “0x2f2” as the key. Both of MPLAB and SDES simulator gives the same cipher text result which is “0xb5”.

**Links:**

Download Source Code

Download SDES Simulator

Download PIC16F84 Datasheet

### Like this:

Like Loading...

*Related*

Very Nice sir, I saw for the first time the Encryption and Decryption in Micro controller based. In software’s like vb and packages I saw the projects. Please tell how to start this project and what are requirements needed for this sir,

with kind regards,

S.vaidyanathan.

Comment by s.vaidyanathan — 5 June 2009 @ 9:50 pm

@s.vaidyanathan

Hi, thank you for visiting my blog. To get involved on this area you got to understade assembly programming language and you got to really understand what is really happened in register level, last you understand the algorithm and there you go.

Happy CodingðŸ™‚

Comment by edipermadi — 8 June 2009 @ 9:35 am

i appreciate your work,i am currently working on my final year project.Its on SDES,i am trying to improve it.Pls can you help?

Comment by kay — 29 November 2010 @ 2:23 am

Hello Kay

Thank you for visiting my blog. The source code is actually quite self explanatory. The tricky part could be bit manipulation part. As long as you understand the SDES specification, you would see the implementation clearly.

K1 and K2 are firstly pre calculated to gain bit to bit mapping from raw key to subkeys directly. once you get the ide, you could extract K1 and K2 directly from raw key without doing the whole key generation step.

Lookup table are left justified to match the inner structure of SDES. the P4 also precomputed and embedded to the lookup table directly so you dont need to perform it on each single iteration.

I/P EP and are done on the fly through bit manipulation. I compared several method and found that as the fastest one. It depends on you, you may choose either speed or code size.

Good Luck with your theses

Comment by edipermadi — 29 November 2010 @ 10:46 am

your works are lovely.I am working on my final year project,it is on SDES,i need help on it

Comment by kay — 29 November 2010 @ 2:30 am