added lsb and msb functions for encoding string length