Cryptographic Primitives Optimization Based on the Concepts of the Residue Number System and Finite Ring Neural Network