Rewrite packihx in C (for platforms without Perl handily available)