D. J. Bernstein
Authenticators and signatures

Choices for conf-opt

The hash127 library includes a variety of machine-specific optimizations. You can change the first line of conf-opt to control which optimizations it uses.


This is the default. One of the possibilities listed below is chosen automatically.


idea works with any C compiler where double is a reasonable implementation of IEEE double-precision (53-bit) floating-point arithmetic.

idea does not work on Linux x86 systems under gcc. Floating-point operations on the x86 architecture are affected by a hidden global variable called ``precision control,'' which normally specifies either 53-bit rounding or 64-bit rounding. Linux sets 64-bit rounding by default; gcc does not set 53-bit rounding before double floating-point operations. (gcc does, however, use 53-bit rounding for double spills to memory. The result is a mishmash of 53-bit rounding and 64-bit rounding, depending on which numbers are stored in registers, which in turn depends on the compiler optimization level.)


sparc is designed for the SPARC processor family. It may not compile on non-SPARC processors in future versions of hash127.

In hash127 0.70, sparc is idea plus some instruction scheduling for the UltraSPARC. hash127_little has not been optimized; in principle it can run at the same speed as hash127.


x86-idea is just like idea, except that it uses 5 64-bit accumulators instead of 8 53-bit accumulators. It won't compile on non-x86 processors.

x86-idea, with gcc -O6, is almost six times slower than pentium on a Pentium. Feel free to point this out to anyone who claims that manual optimization is useless. I would be interested in hearing results from other compilers.


pentium-idea is x86-idea with manual register assignment and instruction scheduling for the Pentium.

pentium-idea will probably not work with any compiler other than gcc -O1. In particular, it labels its variables as double rather than long double; this avoids some instruction selection flaws in gcc, but will not work if the double variables are ever spilled to memory.


pentium is an asm version of pentium-idea. It comes close to the theoretical limit of 3.75 cycles per input byte.


ppro is better than pentium for the Pentium Pro, Pentium II, and Pentium III. It has different instruction scheduling.