The MD5 twystlet is a pure Java implementation of RFC 1321 originally created in a fit of pure masochism for the memory and performance constrained environment of a mobile phone. The code is conservatively optimized using:

  • in-lined method calls and constants
  • unrolled loops
  • careful allocation of local variables
  • byte-code 'tweaks'
to give a high performance implementation in a much reduced footprint.

The implementation includes 3 variants:
  1. A 'minimal' Java implementation that implements only the necessary functionality.
  2. A hand-optimized byte code implementation that offers the same performance as (2) in a slightly reduced footprint.
  3. A hand-optimised byte code implementation that offers the smallest footprint at the expense of reduced throughput.
The download [signature,key] includes:
  • Full source for all implementations.
  • Pre-built class files.
  • JUnit validity tests.
  • Japex performance test drivers.