x-2 variant: modular poly3encoding function