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 “0x706d9fcc1792d23a”. 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😀 ! .


source code v1.0
PIC18F4550 datasheet
MPLAB v8.0

Blowfish Cipher
Bruce Schneier

Official Website:
Bruce Schneier
Blowfish Cipher

1 Comment »

  1. Nice share. I need this to create an EDC device with microcontroller.

    Comment by Bascom — 31 October 2010 @ 1:59 am

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at

%d bloggers like this: