Encoders use custom made 8-pole magnets and 2 haff-effect sensors to provide 2 square waves, 90 degree out of phase with a total of 16 state changes per motor revolution.
These encoders can operate with both 3.3V and 5V logic sustems and have reverse polarity protection built into the sensors. And this geared motor/encoder combination is available as a separate item.