Fhreefish - fast AVR 8-bit implementation of Threefish and Skein
This project is a library for the popular Atmel AVR 8-bit microcontrollers. It implements a high-performance version of the Skein hashing algorithm, one of the candidates for the upcoming SHA-3 standard. The algorithm was designed by a group of experienced cryptanalysts: Niels Ferguson, Stefan Lucks, Bruce Schneier, Doug Whiting, Mihir Bellare, Tadayoshi Kohno, Jon Callas, and Jesse Walker. Bruce Schneier
There is already an implementation of Skein and the associated Threefish encryption algorithm as part of AVR-Crypto-Lib. While that library is feature-complete and offers all sizes/modes, it doesn't even remotely meet the performance estimate presented in the Skein specification. For this reason, I have reimplemented the core threefish algorithm in highly optimized assembler. The Threefish primitive runs in about 8900 cycles, 600 less than estimated.
Features / Specifications
- Threefish-256 encryption and decryption
- Skein-256-256 hashing
- optional hash personalization
- cryptographically secure PRNG based on Skein
- not reentrant, but interrupt safe
- fast:
- Threefish in 8900 cycles
- Skein in 18700 cycles for short messages
- 300 cycles per byte for long messages
- PRNG in 285 cycles per byte (for big amounts)
- no separate key setup required -- included in the above figures
- reasonable code size: 5.3kiB for all features, 2.3kiB for encryption only
- low memory usage: 109 bytes for encryption and decryption, 201 bytes for Skein
- message size up to 2^32-1
- AVR-GCC C API and calling convention
- zero-copy operation and in-place hashing/encryption available
- buildable in AVR Studio or via GNU make
- documentation in fkein.h and fhreefish.h
- maintainable assembler source code
- licensed under the GNU General Public License version 3
History
- Version 1.3.0
- Updated to version 1.3 of the Skein specification. No other changes.
- Version 1.2.2
- Fix hashing of longer messages. Greatly improved test program and performance measurement. PRNG speed improvements.
- Version 1.2.1
- Fix PRNG. Now really works like the specification suggests. Consequently, speed is a lot faster as well.
- Version 1.2
- Initial public release.