Improve performance of work generation by optimizing hex2bin and bin2hex

sprintf is a very expensive function, do direct translation instead.
klondike - better to unlock locks than to lock them twice :)