Implementation of the RSA algorithm in a 8-bit microcontroller 

Here you can download the implementation of the RSA Public-key encryption algorithm, for PIC18 and dsPIC30 microcontrollers.

The source can be compiled with Microchip's C18 C compiler, V3.00 or better. and MPLAB C30. Please don't expect very good perfomance as it's a complex algorithm on a slow CPU.

Technical specs:

  • Stripped down and plataform-optimized version of David Ireland's BigDigits Library.
  • Estandard RSA encryption/decryption/signing algorithm (No key generation, please use OpenSSL, Lockbox, etc.).
  • No need for a dynamic memory manager (malloc)
  • Aprox. 5 Kb of ROM.
  • Aprox. 700 bytes of RAM for 512 bits operation.
  • Measured speed of a single block of data, 512 bits key : 
        • PIC18F452@40Mhz: Encryption: 2 s. Decryption: 120 s.
        • dsPIC30F3013@30Mhz:Encryption: 0.2 s. Decryption: 15 s. 
  • Key size limited by free RAM only.
  • Endianess independent.
  • Permissive Non-GPL Licence (Check BigDigits Site) 

The Assembly optimizations can be turned off, and it's Ansi C so it should compile on other 8/16/32/64-bit architectures.