Forked from http://sourceforge.net/projects/libsharp/