Move common code to Utils.
Fix Uppsalatickets, could generate "uCode" that would overflow 12-char
hex.