Way back in 2007 I I had to implement an encryption technique for PIC microcontroller based communication link via RS232.
After some tests I found out Alexander Pukall’s PC1 encryption algorithm works with almost no modifications. The attached source code can be used for PIC18 microcontrollers. The code can be compiled with HI-TECH PIC18 compiler or with any other C compiler with little modifications. Here when storing large variables in pic microcontroller ram the variables are defined to be stored in different memory banks.
Download: PIC18 Encryption Example Source code