Back to all projects
Mathematics

MODULAR ARITHMETIC APPLICATIONS IN MODERN CRYPTOGRAPHIC SYSTEMS

Admin 0 views 0 downloadsBSc/BA

Notice: This is a sample project for study and reference. Submitting it as your own work violates most universities' academic integrity policies.

Abstract

About This Research Topic

Modular arithmetic, the arithmetic of remainders systematically introduced by Carl Friedrich Gauss in Disquisitiones Arithmeticae (1801), is the exact algebraic substrate of modern cryptography. While RSA rests on factoring, a second equally important family of protocols rests on the discrete logarithm problem (DLP): given generator g and h = g^x in a finite cyclic group, find x. This problem underlies Diffie-Hellman key exchange, ElGamal encryption, and elliptic-curve signatures securing most internet traffic. Beyond DLP itself, practical deployment depends on supporting number theory that is often taken for granted: large primes must be generated and certified, a task where deterministic trial division is infeasible and probabilistic Miller-Rabin is indispensable, and systems of congruences must be solved efficiently via the Chinese Remainder Theorem and modular arithmetic applications.

This study provides a rigorous, proof-based development from the structure of multiplicative group Zp* and primitive roots through to DLP, with full proofs of Diffie-Hellman correctness, ElGamal correctness, and Chinese Remainder Theorem. It then combines theory with four independently verified computational case studies using genuine numbers and independently timed algorithms: complete Diffie-Hellman with nine-digit prime showing identical shared secret, ElGamal encrypt-decrypt cycle with exact recovery, DLP hardness benchmark of brute-force O(p) vs baby-step giant-step O(√p) across 10-36 bit moduli, and Miller-Rabin vs trial division up to 2048 bits demonstrating exponential-to-polynomial improvement that makes key generation feasible.

Main Abstract

This study investigates the applications of modular arithmetic to modern cryptographic systems, with particular emphasis on protocols whose security rests on the discrete logarithm problem, and on the supporting computational machinery, primality testing and the Chinese Remainder Theorem, without which such protocols could not be deployed in practice.

The theoretical development proceeds from the structure of the multiplicative group Zp* and the notion of a primitive root through to the discrete logarithm problem itself, and provides full proofs of Diffie–Hellman key agreement correctness, ElGamal encryption correctness, and the Chinese Remainder Theorem.

The methodology combines this theoretical development with four independently verified computational case studies conducted specifically for this study. First, a complete Diffie–Hellman key exchange is carried out using a genuine nine-digit prime, with both parties independently shown to compute an identical shared secret. Second, an ElGamal encryption and decryption cycle is carried out over the same type of group, with exact recovery of the original message confirmed. Third, the discrete logarithm problem's computational hardness is investigated experimentally by implementing and directly benchmarking two algorithms, brute-force search and the baby-step giant-step algorithm, across moduli of increasing bit length, with measured running times found to be consistent with the respective O(p) and O(√p) complexities predicted by theory. Fourth, the Miller–Rabin primality test, upon which the generation of cryptographic primes depends, is implemented directly and benchmarked against trial division on confirmed primes of up to 2048 bits, demonstrating the exponential-to-polynomial improvement that makes practical key generation feasible at all. A worked numerical instance of the Chinese Remainder Theorem is also presented and verified.

The findings demonstrate that modular arithmetic is not merely a notational convenience in cryptography but the exact algebraic substrate on which key agreement, encryption, and key-generation protocols are built and on which their security guarantees rest, with the experimentally observed algorithmic growth rates providing direct, reproducible evidence for the practical security margins relied upon in real-world systems.

Keywords: modular arithmetic, discrete logarithm problem, Diffie–Hellman key exchange, ElGamal cryptosystem, primality testing, Chinese Remainder Theorem, Miller-Rabin, Zp*

Chapter One Preview

Background to the Study

Modular arithmetic, the arithmetic of remainders introduced systematically by Carl Friedrich Gauss in his 1801 treatise Disquisitiones Arithmeticae, is the exact algebraic setting in which the majority of modern cryptographic protocols are constructed. While the RSA cryptosystem builds its security on the difficulty of factoring a composite modulus, a second and equally important family of cryptographic protocols builds its security on a different modular-arithmetic hardness assumption: the difficulty of the discrete logarithm problem, that is, given a group generator g and an element h = g^x within a finite cyclic group, the difficulty of recovering the exponent x.

This problem, elementary to state, underlies the Diffie–Hellman key exchange protocol, the ElGamal encryption scheme, and, in its elliptic-curve variant, the digital signature and key-agreement protocols that secure the overwhelming majority of contemporary internet traffic.

Beyond the discrete logarithm problem itself, the practical deployment of any modular-arithmetic-based cryptographic system depends on a supporting layer of computational number theory that is easily taken for granted: large prime numbers must be generated efficiently and certified as prime with overwhelming confidence, a task for which deterministic primality testing is far too slow and for which probabilistic algorithms, principally the Miller–Rabin test, are indispensable; and systems of modular congruences arising in protocol design and implementation must be solved efficiently, a task accomplished by the Chinese Remainder Theorem, a result known in essentially its modern form since the work of the Chinese mathematician Sun Tzu in the third to fifth century CE.

This study undertakes a rigorous, proof-based development of the modular arithmetic underlying these protocols and supporting algorithms, followed by an original computational investigation, using genuinely generated numbers and independently timed algorithms rather than assumed or cited figures, of both the correctness of the Diffie–Hellman and ElGamal protocols and the computational hardness assumptions and supporting algorithms on which practical cryptographic deployment depends.

Cryptography and mathematics project topics | Computer science and security topics | External: MIT - Number Theory & Cryptography, Stanford - Cryptography Theory, NIST - Post-Quantum Cryptography

Statement of the Problem

While Diffie–Hellman key exchange and ElGamal encryption are foundational and widely taught cryptographic protocols, their correctness proofs, though elementary, are frequently stated rather than demonstrated with genuine numbers in applied treatments, and the claim that the underlying discrete logarithm problem is computationally hard is rarely substantiated with direct, reproducible computational evidence comparing a naive algorithm against a genuinely sub-exponential (in the small-group case, square-root) algorithm.

Similarly, the practical feasibility of generating cryptographic-strength primes is often asserted without direct demonstration of why deterministic trial division is infeasible at cryptographic key sizes while the probabilistic Miller–Rabin test remains fast even at 2048 bits. There is, therefore, a need for a treatment that both proves the correctness of these protocols from first principles and empirically demonstrates, through directly implemented and timed algorithms, the computational asymmetries on which their practical security and feasibility depend.

Aim and Objectives of the Study

The aim of this study is to investigate the applications of modular arithmetic to modern cryptographic systems, with emphasis on discrete-logarithm-based key exchange and encryption, and on the supporting computational number theory of primality testing and the Chinese Remainder Theorem.

·         Develop the necessary group-theoretic foundations of Zp*, primitive roots, and the discrete logarithm problem;

·         State and prove the correctness of the Diffie–Hellman key exchange protocol and the ElGamal encryption scheme, and verify both numerically using genuine multi-digit primes;

·         Implement and directly benchmark two discrete logarithm algorithms, brute-force search and the baby-step giant-step algorithm, across moduli of systematically increasing bit length;

·         Implement and directly benchmark two primality-testing algorithms, trial division and the Miller–Rabin test, across confirmed primes of systematically increasing bit length, up to cryptographic key sizes; and

·         State, prove, and numerically verify the Chinese Remainder Theorem as a supporting computational tool.

Research Questions

·         What group-theoretic structure underlies the discrete logarithm problem, and how does it support the Diffie–Hellman and ElGamal protocols?

·         How can the correctness of Diffie–Hellman key agreement and ElGamal encryption be verified numerically using genuine large primes?

·         How does the running time of brute-force discrete logarithm search compare with that of the baby-step giant-step algorithm as the modulus grows?

·         How does the running time of trial division compare with that of the Miller–Rabin test for certifying primality, and at what point does trial division become impractical for cryptographic key generation?

·         How does the Chinese Remainder Theorem provide an efficient method for solving systems of modular congruences relevant to cryptographic computation?

Significance of the Study

This study is significant academically because it connects group theory and elementary number theory directly to the protocols that secure everyday digital communication, complementing factorisation-based treatments of cryptography with the equally important discrete-logarithm-based family of protocols.

Pedagogically, it provides fully worked, independently verified numerical examples of Diffie–Hellman and ElGamal, together with original benchmark data on discrete logarithm and primality-testing algorithm performance, addressing the common gap between cited security claims and demonstrated computational evidence.

Practically, the study's benchmarks provide concrete, reproducible evidence for why cryptographic key sizes are chosen as they are, and for why probabilistic primality testing, rather than deterministic methods, underlies real-world key generation.

Information security project topics | Number theory research materials

Scope of the Study

The study covers the group-theoretic and number-theoretic foundations of Diffie–Hellman key exchange and ElGamal encryption over the multiplicative group Zp* for prime p, together with two discrete logarithm algorithms (brute-force search and baby-step giant-step, benchmarked directly on moduli from 10 to 36 bits) and two primality-testing algorithms (trial division, benchmarked up to 40 bits, and Miller–Rabin, benchmarked up to 2048 bits). The study does not implement the index calculus method or other sub-exponential discrete logarithm algorithms, nor elliptic-curve variants of these protocols, both of which are discussed descriptively, with reference to the literature, in Chapter Two and Chapter Five.

Operational Definition of Terms

Modular Arithmetic: A system of arithmetic for integers in which numbers wrap around upon reaching a fixed value, the modulus.

Primitive Root (Generator): An element g of Zp* whose powers g¹, g², ..., g^{p−1} exhaust all of Zp*, i.e., an element of multiplicative order p−1.

Discrete Logarithm Problem: Given a generator g of a finite cyclic group and an element h in that group, the problem of finding the integer x such that g^x = h.

Diffie–Hellman Key Exchange: A protocol by which two parties, exchanging only public values over an insecure channel, compute an identical shared secret without ever transmitting it directly.

ElGamal Cryptosystem: A public-key encryption scheme whose security is based on the discrete logarithm problem, built directly on the Diffie–Hellman construction.

Primality Test: An algorithm that determines whether a given integer is prime; may be deterministic (always correct, e.g., trial division) or probabilistic (correct with overwhelming, tunable probability, e.g., Miller–Rabin).

Chinese Remainder Theorem: A theorem guaranteeing that a system of simultaneous congruences with pairwise coprime moduli has a unique solution modulo the product of the moduli.

Conclusion

The study confirms that modular arithmetic is not merely notational convenience but the exact algebraic substrate of discrete-logarithm-based cryptography. Diffie-Hellman correctness and ElGamal correctness were proved and numerically verified using genuine nine-digit primes, with both parties independently deriving identical shared secrets and exact message recovery.

Benchmarking demonstrated computational hardness: brute-force DLP search exhibits O(p) growth while baby-step giant-step achieves O(√p), with measured times consistent with theory across 10-36 bit moduli. For primality testing, trial division becomes infeasible beyond 40 bits, while Miller-Rabin remains efficient even at 2048 bits, providing the exponential-to-polynomial improvement that makes practical key generation possible.

The Chinese Remainder Theorem was proved and numerically verified as an efficient tool for solving simultaneous congruences. Together, these findings provide reproducible evidence for the security margins and feasibility assumptions underlying real-world cryptographic systems, and explain why key sizes and probabilistic testing are chosen as they are.

Frequently Asked Questions (FAQs)

What is modular arithmetic in cryptography?

Modular arithmetic is arithmetic of remainders modulo p; it defines the groups Zp* where Diffie-Hellman and ElGamal operate and security assumptions rest.

What is discrete logarithm problem?

Given generator g and h = g^x in finite cyclic group, find x. Easy to compute h from x, believed hard to reverse, underlying DLP-based cryptography.

How does Diffie-Hellman key exchange work?

Two parties exchange g^a and g^b publicly; each computes (g^b)^a = (g^a)^b = g^{ab} as shared secret without transmitting it, correctness proved and verified with nine-digit prime in this study.

How does ElGamal encryption work?

ElGamal builds on Diffie-Hellman: public key h=g^x, encryption uses random k to produce (g^k, m·h^k), decryption uses private x to recover m, with exact recovery verified numerically.

Why compare brute-force vs baby-step giant-step?

Brute-force is O(p) linear search; baby-step giant-step is O(√p) time-memory trade-off, demonstrating square-root improvement predicted by theory and substantiating DLP hardness claims with measured times.

Why is Miller-Rabin needed for key generation?

Trial division is exponential and infeasible beyond ~40 bits; Miller-Rabin is polynomial and remains fast at 2048 bits, enabling practical generation of cryptographic primes with overwhelming confidence.

What is Chinese Remainder Theorem?

CRT guarantees unique solution modulo product of pairwise coprime moduli for system of congruences, providing efficient method for solving modular systems arising in cryptographic implementation.

What is primitive root in Zp*?

An element g whose powers generate all of Zp*; its existence for prime p ensures Zp* is cyclic, foundational for DLP-based protocols.

Is 36-bit benchmark relevant to 2048-bit security?

Direct DLP benchmarking at 2048 bits is infeasible; 10-36 bit range shows asymptotic O(p) vs O(√p) trends, which extrapolate via theory and index-calculus literature to explain real-world key size choices.

What are limitations of this study?

No implementation of index calculus or elliptic-curve variants; DLP benchmarking limited to 36 bits due to impracticality at cryptographic sizes, addressed by citing established sub-exponential results.

Purchase to unlock the full material.