Cryptography
Cryptography
COURSE REPORT
ON
Cryptography and Network Security
Submitted by:
Name: Yashika
Enrollment No.: 00590202024
Date: 26th August 2025
Course: Bachelor of Computer Applications (BCA)
INDEX
Project Details 3 to 7
Unit 1: Introduction to 8 to 16
Cryptography
Unit 2: Hash Functions 17 to 22
Conclusion 51 to 52
Introduction
In today’s digital world, where vast amounts of data are
generated, transmitted, and stored electronically, the security of
information has become a critical concern. Cryptography and
network security form the cornerstone of protecting sensitive
data from unauthorized access, modification, and misuse.
Cryptography is the science of designing techniques to secure
information and communications through codes, enabling only
intended recipients to access the original message. Network
security involves protecting data during transmission across
networks, ensuring the confidentiality, integrity, and availability
of information.
1|Page
It explores various cryptographic methods including symmetric
and asymmetric encryption, hash functions, digital signatures,
and key management strategies. Further, network protection
mechanisms such as SSL/TLS, digital certificates, email
security, and IPsec are discussed. The report also examines
emerging topics including blockchain technology and quantum
cryptography, highlighting their role in strengthening security
frameworks.
2|Page
Project
Introduction
We developed a simple encryption tool using Java language.
This tool uses the Advanced Encryption Standard (AES)
algorithm to encrypt and decrypt text. The tool provides users
with a simple and secure way to protect their data.
3|Page
Key Code
1. Key Generation
KeyGenerator keyGen = KeyGenerator.getInstance(“AES”);
keyGen.init(128);
SecretKey secretKey = keyGen.generateKey();
- This code generates a secret key for AES encryption.
- ‘KeyGenerator.getInstance(“AES”)’gets an instance of the
AES key generator.
- `keyGen.init(128)` initializes the key generator with a key size
of 128 bits.
- `secretKey = keyGen.generateKey()` generates the secret key.
2. Encryption
Cipher cipher = Cipher.getInstance(“AES”);
Cipher.init(Cipher.ENCRYPT_MODE, secretKey);
Byte[] encryptedBytes =
cipher.doFinal(text.getBytes(StandardCharsets.UTF_8));
- This code encrypts the text using the AES algorithm.
- `Cipher.getInstance(“AES”)` gets an instance of the AES
cipher.
4|Page
- `cipher.init(Cipher.ENCRYPT_MODE, secretKey)` initializes
the cipher for encryption mode with the secret key.
- `cipher.doFinal(text.getBytes(StandardCharsets.UTF_8))`
encrypts the text and returns the encrypted bytes.
3. Decryption
Cipher cipher = Cipher.getInstance(“AES”);
Cipher.init(Cipher.DECRYPT_MODE, secretKey);
Byte[] decryptedBytes =
cipher.doFinal(Base64.getDecoder().decode(encryptedText));
- This code decrypts the encrypted text using the AES algorithm.
- `Cipher.getInstance(“AES”)` gets an instance of the AES
cipher.
- `cipher.init(Cipher.DECRYPT_MODE, secretKey)` initializes
the cipher for decryption mode with the secret key.
- `cipher.doFinal(Base64.getDecoder().decode(encryptedText))`
decrypts the encrypted text and returns the decrypted bytes.
5|Page
Byte[] decryptedBytes =
Base64.getDecoder().decode(encryptedText);
- This code uses Base64 encoding and decoding to convert the
encrypted bytes to a string and vice versa.
- `Base64.getEncoder().encodeToString(encryptedBytes)`
encodes the encrypted bytes to a Base64 string.
-
`Base64.getDecoder().decode(encryptedText)` decodes the
Base64 string back to the encrypted bytes.
Screenshot
6|Page
Bibliography
- Java Documentation:
https://docs.oracle.com/javase/8/docs/api/
- AES Algorithm:
https://en.wikipedia.org/wiki/Advanced_Encryption_Standa
rd
7|Page
Unit 1: Introduction to Cryptography
8|Page
Authentication: Confirms the identity of the sender and
receiver, ensuring the parties engaging in communication are
genuine. Techniques include digital signatures and cryptographic
certificates.
9|Page
• Symmetric-Key Cryptography: Uses the same secret key
for both encryption and decryption. Both sender and
receiver must share
this key in advance. It
is fast and efficient
for processing large
amounts of data but
poses challenges in
secure key
distribution.
• Asymmetric-Key
Cryptography
(Public-Key
Cryptography):
Uses a pair of
mathematically
related keys—a
public key for
encryption and a private key for decryption. The public key
can be freely distributed, while the private key remains
secret. This method resolves key distribution problems and
enables secure communication even when the parties have
never met.
10 | P a g e
Additionally, cryptographic hash
functions take an input and produce
a fixed-length output (hash) that
uniquely represents the data. They
are used to verify the integrity of
messages and in digital signatures.
11 | P a g e
• SSL/TLS (Secure Sockets Layer / Transport Layer
Security): Protocols used to establish secure encrypted
connections between web browsers and servers.
• Phishing: A cyberattack technique where attackers
impersonate trustworthy entities to steal sensitive
information.
• Denial of Service (DoS) Attack: An attempt to make a
machine or network resource unavailable to users by
overwhelming it with traffic.
• Public Key Infrastructure (PKI): A framework for
creating, distributing, and managing digital certificates to
secure communications.
• Digital Certificate: An electronic credential that verifies
the identity of entities online, issued by a trusted authority.
• MAC (Message Authentication Code): A short piece of
information used to authenticate a message and confirm its
integrity and authenticity.
• Zero Trust Security: A security model that requires strict
identity verification for every person and device trying to
access resources, regardless of whether they are inside or
outside the network.
12 | P a g e
1.2 Block Ciphers vs. Stream Ciphers
• Block Cipher:
Think of a block cipher like a safe that locks a fixed-size box of
data at once. It takes a chunk (block) of data, for example, 128
bits, and encrypts it all together using complex math. If the data
doesn’t fit perfectly, it adds extra padding. This approach is very
secure and is often used for things like encrypting files or
messages for storage. Examples include AES and DES.
• Stream Cipher:
A stream cipher is like locking each letter in a message one by
one as it comes. It encrypts data bit-by-bit or byte-by-byte
continuously, which makes it faster and better for real-time data
like live video or audio. There’s no padding needed since it
processes each piece as it arrives. However, it’s more sensitive
to errors and requires careful key management. Examples
include RC4 and Salsa20.
1.3Substitution Cipher
A substitution cipher is a simple encryption method where each
letter or character in the original message (plaintext) is replaced
by another letter, number, or symbol according to a fixed system
or key. The order of characters stays the same, but the characters
themselves are changed to keep the message secret.
13 | P a g e
Key points:
• Each plaintext letter is mapped to a different ciphertext
letter.
• Examples include the Caesar cipher, where letters are
shifted by a certain number in the alphabet (e.g., A becomes
D if shifted by 3).
14 | P a g e
Example:
Plaintext: HELLO
With a shift of 3 (Caesar
cipher),
ciphertext: KHOOR
1.4Transposition Ciphers
A transposition cipher is a method of encryption where the
positions of the characters in the plaintext are rearranged (or
shuffled) according to a specific system or key, without
changing the characters themselves. This produces a ciphertext
that is a scrambled version of the original message.
Key points:
• Unlike substitution ciphers, which replace characters,
transposition ciphers only change the order of the
characters.
• It rearranges letters based on a pattern, like writing the
message into rows and then reading it off in columns.
16 | P a g e
Unit 2:Hash Functions
17 | P a g e
Uses:
• Used in data storage and retrieval (like indexing in hash
tables).
• Used in security, for example, to store passwords
securely or verify data integrity.
• Used in digital signatures and message authentication.
Simple analogy:
Think of a hash function like a blender: you put any
ingredients (data) into it, and it produces a smoothie of a
fixed size (hash value). You can’t easily separate the
ingredients from the smoothie, and even changing a tiny
bit of the ingredients changes the smoothie drastically.
Very common cryptographic hash functions include
SHA-256 and SHA-512.
2.2Collision Resistance
Collision resistance is a property of cryptographic hash
functions that makes it very hard to find two different inputs
producing the same hash output.
18 | P a g e
Importance of Collision Resistance:
Protects data integrity: Ensures that data hasn’t been
changed or tampered with.
Secures digital signatures: Prevents someone from creating
a fake message with the same hash as a genuine one.
Prevents fraud in security systems: Like cryptocurrencies
or password storage, collision resistance helps avoid attacks
where two different inputs can trick security checks.
Without collision resistance, attackers could forge data or
impersonate others by exploiting hash collisions.
19 | P a g e
Chosen-prefix Collisions: Advanced attacks allow attackers
to produce collisions even when parts of the message are
fixed or predefined, increasing the risk.
Examples of Exploits: The Flame malware in 2012 exploited
MD5 collisions to forge Windows code-signing certificates.
2.3Merkle-Damgard Construction
The Merkle–Damgård construction is a method for building
cryptographic hash functions securely from a smaller, fixed-
size function called a compression function.
How it works:
• The input message is first padded to make its length a
multiple of a fixed block size.
• The padded message is split into blocks of equal size.
• The hash function processes these blocks one-by-one in
a sequence.
• It starts with an initial value (IV).
• Each block is combined (using the compression
function) with the result of the previous block’s
processing.
• This chain continues until all blocks are processed,
producing a fixed-size hash output.
20 | P a g e
Key properties:
• If the compression function used is collision-resistant,
the whole hash function built this way is also collision-
resistant.
• Many popular hash functions like MD5, SHA-1, and SHA-
2 use this construction.
• The construction includes padding that encodes the
original message length, which helps prevent certain
attacks.
21 | P a g e
• It is widely used for security purposes like verifying data
integrity, digital signatures, and password protection.
22 | P a g e
Unit3: Symmetric
Encryption
How it works:
• The original message (called plaintext) is encrypted
using a secret key into an unreadable form (called
ciphertext).
• The receiver uses the same secret key to decrypt the
ciphertext back to the original plaintext.
Key points:
• Also called secret-key encryption or single-key
encryption.
• Examples include AES (Advanced Encryption Standard),
DES (Data Encryption Standard), and Blowfish.
23 | P a g e
• It Is fast and efficient, suitable for bulk data encryption.
• The biggest challenge is securely sharing the secret key
between sender and receiver.
• Commonly used for encrypting data at rest and for
secure communication channels.
Use cases:
• Securing communications like emails or messages.
• Encrypting files and databases.
• Protecting data in financial transactions.
3.2Feistel Cipher
A Feistel cipher is a symmetric encryption design model
used to create many block ciphers, including the well-known
DES (Data Encryption Standard). It is named after Horst
Feistel, who introduced this structure.
In each round:
24 | P a g e
• A round function (usually complex and involving a
subkey) is applied to the right half and combined
(usually XOR) with the left half.
• Then, the halves are swapped.
• This process is repeated for a specified number of
rounds.
• After the last round, the halves are combined to
produce the ciphertext.
25 | P a g e
5. The halves are recombined, and a final permutation
produces the ciphertext.
26 | P a g e
3.4Advanced Encryption Standard (AES)
The Advanced Encryption Standard (AES) is a widely used
symmetric key encryption algorithm designed to securely
encrypt and decrypt data. It was established by the U.S.
National Institute of Standards and Technology (NIST) in
2001, replacing the older DES algorithm.
27 | P a g e
• Block cipher: AES processes data in fixed-size blocks
of 128 bits (16 bytes).
• Key sizes: Supports three key lengths — 128 bits, 192
bits, and 256 bits, offering different levels of security.
• Number of rounds: AES-128 uses 10 rounds, AES-192
uses 12 rounds, and AES-256 uses 14 rounds of
encryption to strengthen security.
• Strong security: Resistant to all known attacks, making
it suitable for protecting sensitive data.
• Efficiency: Highly efficient in both software and
hardware implementations.
• Substitution-Permutation Network: Uses multiple
rounds of substitution, permutation, and mixing steps
to transform plaintext into ciphertext.
28 | P a g e
Unit4: Asymmetric Encryption
How it works:
• The public key is shared openly and used to encrypt
data.
• The private key is kept secret and used to decrypt data.
• This mechanism allows secure communication without
the need to share secret keys beforehand.
Key features:
• Two keys: One for encryption (public) and one for
decryption (private).
• Security: Even if the public key is known, data cannot
be decrypted without the private key.
• Digital signatures: The private key can be used to sign
data, and the public key can verify the signature,
ensuring authenticity.
• Secure key exchange: Used to safely exchange
symmetric keys over insecure channels.
29 | P a g e
4.1Introduction to Public Key Cryptography
Public key cryptography, also known as asymmetric
cryptography, is a method of secure communication that uses a
pair of mathematically related keys:
• A public key, which is shared openly and used to encrypt
data.
• A private key, which is kept secret and used to decrypt data.
• These two keys work together such that data encrypted
with the public key can only be decrypted by the matching
private key, ensuring confidentiality.
How it works:
• When someone wants to send you a secure message, they
use your public key to encrypt it.
• Only you, the owner of the private key, can decrypt and
read the message.
• This removes the need to share a secret key in advance,
making communication secure even over untrusted
networks.
30 | P a g e
4.2The RSA Cryptosystem
RSA is a way to keep messages safe by using two keys: one
public, one private.
Public key: Anyone can see and use this to lock (encrypt) a
message.
Private key: Only the owner has this key to unlock
(decrypt) the message.
Why is it safe?
Multiplying two big primes is easy, but figuring out the
original primes from the product is super hard for
computers.
Simple example:
Public key: Lock box anyone can put messages inside.
Private key: Your unique key to open the lock box.
31 | P a g e
4.3The RSA (Rivest-Shamir-Adleman) Encryption
System
What is RSA?
RSA is a way to send secret messages securely using two keys—
a public key and a private key. It’s named after its inventors:
Ron Rivest, Adi Shamir, and Leonard Adleman. The system is
based on a math problem that is easy to do one way (multiplying
big prime numbers) but very hard to reverse (factoring those big
numbers).
How RSA Works:
You create two keys:
• The public key (shared openly).
• The private key (kept secret).
Someone who wants to send you a message:
• Uses your public key to lock (encrypt) the message.
• You unlock (decrypt) the message:
• Using your private key, only you can read it.
Simple Analogy:
1. Think of your public key as a locked mailbox anyone can
put letters into.
32 | P a g e
2. Your private key is the only key that can open that mailbox
and read the letters.
3. Even if others see the mailbox, they cannot open it without
your private key.
33 | P a g e
Unit5:Signatures and Certificates
5.1Message Integrity
A digital signature is a way to prove that a digital message or
document really comes from the claimed sender and has not
been altered. It provides:
Authentication: Confirms the sender’s identity.
Integrity: Ensures the message hasn’t been changed.
Non-repudiation: The sender cannot deny sending the message.
Confidentiality: Ensures that information is only accessible to
authorized parties.
Availability: Ensuring information and resources are accessible
to authorized users whenever needed.
34 | P a g e
How a MAC works:
1. The sender and receiver share a secret symmetric key.
35 | P a g e
Use Cases:
• Securing network communications.
How it works:
• The sender and receiver share a secret key.
• The secret key is combined with the message before
hashing.
• The hashing process is done twice with the key included,
creating a MAC (Message Authentication Code).
• This ensures the hash value depends on both the message
and the key.
36 | P a g e
5.4Digital Signatures and Certificates
Digital Signatures:
37 | P a g e
Certificates:
• A digital certificate links a public key to an entity’s identity,
issued by a Certificate Authority (CA).
• It contains the public key, the identity information,
expiration date, and CA’s signature.
• Certificates ensure trust in digital communications (e.g.,
SSL/TLS certificates for HTTPS websites).
38 | P a g e
Unit 6:Key Management
39 | P a g e
The structure of cyclic groups makes them especially important
in number theory and cryptography because they are simple to
analyze and understand.
Examples in Cryptography:
1. Cyclic groups underpin many cryptographic protocols by
providing a foundation for hard problems like the Discrete
Logarithm Problem (DLP).
Summary:
Diffie-Hellman key exchange allows secure generation of a
shared secret key between two parties over an insecure channel
without actually transmitting the key, relying on complex
mathematical problems to prevent eavesdroppers from
discovering the secret.
41 | P a g e
Unit7:Zero-Knowledge Proofs
7.1 Introduction to Zero-Knowledge Proofs
A Zero-Knowledge Proof is a cryptographic method where
one party (called the Prover) can prove to another party
(called the Verifier) that they know a secret or that a
statement is true—without revealing any information about
the secret itself.
Why is it Important?
• Enables verification of facts without exposing private
data.
42 | P a g e
• Used in privacy-enhancing technologies like secure
authentication systems, blockchain privacy, and
confidential transactions.
Intuitive Example:
• Imagine a cave shaped like a loop with a locked door
inside. The prover claims to know the secret passcode
to open the door but doesn’t want to reveal it.
• The prover goes into the cave and chooses one path.
• The verifier calls out which path the prover must come
out from.
• If the prover knows the passcode, they can open the
door and come out as requested.
• Repeating this multiple times convinces the verifier
that the prover knows the secret without telling them
the passcode.
7.2SNARKS
43 | P a g e
Succinct: Very short and fast to verify.
Key Points:
• Zk-SNARKs enable privacy-preserving proofs, especially
in blockchains, allowing transactions to be verified without
revealing sender, receiver, or amount.
• Used widely in privacy-focused cryptocurrencies like
Zcash.
• They require a trusted setup phase to generate the public
parameters; if compromised, it can break security.
• Zk-SNARKs rely on elliptic curve cryptography and are
extremely efficient in terms of proof size and verification
time.
Applications:
• Privacy-preserving transactions.
• Scalable and efficient blockchain systems.
• Secure identity verification without revealing personal data.
44 | P a g e
Unit8:Quantum Key Distribution
8.1Photon Polarization
45 | P a g e
• Photons, the particles of light, can be polarized in different
directions (e.g., horizontal, vertical, diagonal).
8.2Current Technology
Quantum Key Distribution (QKD) technology is rapidly
advancing and moving from experimental stages toward
commercial applications as of 2025. Here are key
highlights of the latest developments:
Key Innovations:
• Multiplexing Technology: Toshiba and KDDI Research
demonstrated the world’s first multiplexing system that
allows QKD secret keys and high-capacity data signals to
share a single optical fiber. This breakthrough supports data
46 | P a g e
transmission speeds of 33.4 Tbps over 80 km, lowering
deployment costs by eliminating dedicated fibers for key
exchange.
47 | P a g e
Unit9:Quantum Algorithms
9.1Quantum Operators
Quantum operators are the mathematical tools used to
describe and manipulate quantum states during quantum
key distribution. They characterize how quantum states
(qubits or photons) evolve, are measured, or interact in
QKD protocols.
49 | P a g e
• This motivates transitioning to quantum-resistant
algorithms and integrating quantum methods like QKD for
secure communications.
50 | P a g e
Conclusion
The study of Cryptography and Network Security has
shown how essential these fields are in protecting data and
communication in the modern digital world. Cryptography
provides the mathematical foundations and techniques for
securing information through encryption, hashing, digital
signatures, and key management, ensuring confidentiality,
integrity, and authenticity of data. On the other hand,
network security focuses on safeguarding the transmission
of data across networks by implementing secure protocols,
firewalls, intrusion detection systems, and preventive
mechanisms against cyberattacks.
51 | P a g e
This project and vocational course have not only enhanced
my theoretical knowledge but also provided practical
exposure to real-world applications of information security.
The skills and insights gained will be highly valuable in
addressing current and future challenges in cybersecurity.
In conclusion, cryptography and network security are the
backbone of trust in the digital era, making them
indispensable in every aspect of technology and
communication.
52 | P a g e