Multi-level signals and sequences have become a significant aspect of modern high-speed communication systems. Hence, to ensure the confidentiality and integrity of the transmitted information, advanced methods and devices are necessary to produce strong cryptographic properties for not only binary but also for nonbinary keystreams, which can be used in resource-constrained microcontrollers. The proposed method and apparatus generate both a balanced nonlinear 5-ary pseudo-random sequence and a binary keystream sequence. The nonlinearity is determined by applying shrinking and multiplexing techniques to the generated linear 5-ary pseudo-random sequence and the running zero in its conversion to a binary balanced sequence.