We propose a new parametrization of the resonant Rossby/drift wave triads to develop an algorithm to enumerate all resonant triads in a given grid of wavenumbers. To arrive at such a parametrization, we have employed tools from arithmetic/algebraic geometry to project resonant triads on a certain class of conics. Further, we extend the newly developed algorithm for the enumeration of quasi-resonant triads and experimentally show that the said algorithm is robust to design the network of quasi-resonances. From the experimental results, we observed that the new algorithm enumerates all triads in low computation time when compared with the existing methods. Finally, we apply this work to information security by constructing a total order on the enumerated resonant triads to design a substitution box (S-box) generator. Via extensive analyses over several indicators (nonlinearity, algebraic complexity, linear and differential approximation probabilities, strict avalanche criteria, and bit independence criterion) we show that the newly developed S-box outperforms the S-boxes constructed by most of the existing schemes.