The Hardware Side of Cryptography

7 July 2008

Fast blowfish block cipher implementation on PIC18F4550

Filed under: encryption — Tags: , , — edipermadi @ 10:00 am

i’ve ported blowfish source code that originally written for PIC16F877 microcontroller. It works twice faster than the original one. It can encrypt and decrypt data just in 2310 cycles which is fast. This cipher was invented by the “Security Guru” Bruce Scheneier. The core of blowfish cipher is made from addition, substitution and XOR processes and organized inside 18 rounds feistel structure. For example if plain text and key all contain zeros, the output of blowfish cipher would be “0×706d9fcc1792d23a”. Check out two screenshots below.

Plain Text

Cipher Text

I’ve tested this implementation against several test vector and it works the same as specification. However, this code is released for free under the term of GNU Public License v3.0 and comes with absolutely no guarantee at all. So, take your own risk while using this code. The implementation here is intended for performance oriented application, where throughput is everything :) . I’ll keep modifying this code till it reach the fastest one. Keep visiting this blog and happy coding :D ! .

RELATED STUFF

Download:
source code v1.0
PIC18F4550 datasheet
MPLAB v8.0

Reference:
Blowfish Cipher
Bruce Schneier

Official Website:
- Bruce Schneier
- Blowfish Cipher

Blog at WordPress.com.