The algorithm for Expresso is written in KeyKit, and here's the source code. For more information, email tjt@nosuch.com.