How janagiram-kumar/cns-new works
Purpose and Execution Model
This is a collection of standalone Java cryptography exercises, organized by assignment (EX1–EX7). There is no shared application framework, build system, README guidance, or central launcher. Each class is expected to be compiled and run independently, likely through its own main method and console input/output.
Number-Theory Foundations
EX1 contains the arithmetic primitives and primality testing used conceptually by later public-key exercises:
• Euclidean GCD variants: EX1/GCD.java, EX1/GCDE.java
• Extended Euclidean algorithm: EX1/ExtendedEuclid.java
• Euler totient computation: EX1/EulerTotient.java
• Miller–Rabin probabilistic primality testing: EX1/MillerRabin.java
These programs establish modular arithmetic, coprimality, inverses, and prime validation boundaries needed for RSA, Diffie–Hellman, and ElGamal.
Classical Cipher Implementations
EX2 implements substitution and polyalphabetic cipher workflows, generally transforming plaintext to ciphertext and reversing the process from user-provided keys:
• EX2/CaesarCipher.java
• EX2/VigenereCipher.java
• EX2/PlayfairCipher.java
• EX2/HillCipher.java
• EX2/OneTimePad.java
The main boundary is text normalization and key handling: these algorithms operate on character sequences rather than shared domain models or persisted data.
Transposition Cipher Stage
EX3 isolates positional rearrangement ciphers:
• EX3/RailFenceCipher.java
• EX3/RowColumnTranspositionCipher.java
Unlike substitution ciphers, these preserve character identities while changing ordering. They are independent console-oriented implementations, with no indicated integration into the EX2 cipher classes.
Symmetric-Key Demonstration
EX4/SDES.java implements Simplified DES, representing the repository’s block-cipher / symmetric-encryption exercise. Its architecture is expected to center on bit-level permutation, key scheduling, round functions, and encrypt/decrypt control paths, rather than production DES interoperability.
Public-Key Key Agreement and Encryption
The public-key exercises separate major cryptographic roles:
• EX5/RSA.java covers RSA key construction and modular-exponentiation encryption/decryption.
• EX6/DiffeHellman.java models Diffie–Hellman key agreement between parties.
These components depend on externally supplied or generated numeric parameters; no certificate authority, keystore, network transport, or secure randomness infrastructure is represented in the tree.
Digital Signature Workflow
EX7/ElGamalSignature.java implements ElGamal signing and verification. It forms the repository’s authentication/integrity stage: private-key-based signature generation and public-parameter-based verification. Its trust boundary is the supplied message, key material, and domain parameters; there is no external identity service or persistence layer.
Runtime and Infrastructure Boundaries
The material runtime is Java source compiled directly with a JDK. The repository has no declared package hierarchy, dependency manager, test suite, service runtime, database, network API, or external cloud/service integration. Each exercise is therefore an isolated educational executable rather than a deployable cryptographic system.
Main entry points: MillerRabin.java Miller–Rabin · ExtendedEuclid.java Extended Euclid · RSA.java RSA · GCD.java GCD
Components 18
EX1 Number Theory
Standalone arithmetic and primality exercises.
- GCD
EX1/GCD.java - Euclidean GCD
EX1/GCDE.java - Extended Euclid · Computes Bézout coefficients and modular inverses.
EX1/ExtendedEuclid.java - Euler Totient
EX1/EulerTotient.java - Miller–Rabin · Probabilistic prime validation.
EX1/MillerRabin.java
EX2 Classical Ciphers
Independent text and key driven cipher programs.
- Caesar Cipher
EX2/CaesarCipher.java - Vigenère Cipher
EX2/VigenereCipher.java - Playfair Cipher
EX2/PlayfairCipher.java - Hill Cipher
EX2/HillCipher.java - One-Time Pad
EX2/OneTimePad.java
EX3 Transposition
Independent positional rearrangement ciphers.
- Rail Fence Cipher
EX3/RailFenceCipher.java - Row-Column Transposition
EX3/RowColumnTranspositionCipher.java
EX4 Symmetric Encryption
Simplified DES demonstration.
- S-DES Control · Drives simplified block encryption and decryption.
EX4/SDES.java - Key Schedule · Derives round keys from supplied key bits.
- Permutation & Rounds · Applies bit permutations and Feistel-style round processing.
EX5–EX7 Public Key
Independent encryption, agreement, and signature exercises.
- RSA · Key construction plus modular-exponentiation encryption/decryption.
EX5/RSA.java - Diffie–Hellman · Two-party shared-secret agreement from numeric parameters.
EX6/DiffeHellman.java - ElGamal Signature · Signs messages and verifies with public parameters.
EX7/ElGamalSignature.java
Connections 11
- S-DES Control → Key Schedule: derives round keys
- S-DES Control → Permutation & Rounds: encrypts / decrypts through
- Key Schedule → Permutation & Rounds: round keys
- GCD → Extended Euclid: extends coprimality arithmetic
- Extended Euclid → RSA: modular inverse foundation
- Euler Totient → RSA: key construction foundation
- Miller–Rabin → RSA: prime validation foundation
- GCD → Diffie–Hellman: number-theory foundation
- Miller–Rabin → Diffie–Hellman: prime parameter foundation
- Extended Euclid → ElGamal Signature: modular arithmetic foundation
- Miller–Rabin → ElGamal Signature: prime parameter foundation