Encodes message linearly max amount of times.