27 June 2008

An implementation of SHA-1 on the PIC16 F88

Here's an implementation of the SHA-1 message digest algorithm for the PIC16-family of 8-bit microcontrollers. I wrote it as part of a larger project (secret, until a soon-in-the-future date). I have verified it against several testcases of varying length (up to 1,000,000 characters), and it all seems to work well.

The code for this implementation is 520 instruction words, though a careful coder could chop it down by perhaps as much as 64 words. A more pressing issue is that it requires a lot of RAM--120 bytes, across two banks. For those unfamiliar with these microcontrollers, I give perspective by saing that the PIC16F88--a relatively big PIC16--has 368 bytes of RAM total.

When using the byte-oriented API, simulation shows that an average of 685 instructions cycles are required for each message byte, or reciprocally, about 7KB/sec throughput.

So, please enjoy the source code. It works fine with gpasm and gpsim, though I haven't tried it with the windows-only tools provided by microchip.

1 comment:

Anonymous said...

The most advanced resource for young [url=http://torrents.trion.mk.ua]TTT[/url]