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, most notably including
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 8800 cycles,
700 less than estimated.


Speed
-----

 * Threefish in 8800 cycles
 * Skein in 18500 cycles for short messages
 * 290 cycles per byte for long messages
 * PRNG in 310 cycles per byte (for big amounts)

Actually, these figures could be even lower. During development, encryption
was at 8500 cycles, but the result was awkward to use. The current
implementation tries to balance flexibility and performance by sacrificing
a little speed.


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
 * no separate key setup required -- included in the above figures
 * reasonable code size: 7.5kiB for all features, 2.5kiB for encryption only
 * low memory usage: about 100 bytes including storage for input and output text
 * 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
 * readable assembler source code


License
-------

Copyright (C) 2010 Jörg Walter <info@syntax-k.de>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
