Summer - Intern - BTech - 2020 - 10xxx Final Word File
Summer - Intern - BTech - 2020 - 10xxx Final Word File
Summer - Intern - BTech - 2020 - 10xxx Final Word File
APPLICATION
A Report
Submitted in partial fulfilment of the requirements for the award of the
Degree of
Bachelor of Technology
in
ABC
BTECH/10xxx/20
Ranchi,
Jharkhand – 835215
1
APPROVAL OF THE GUIDE
2
DECLARATION CERTIFICATE
I certify that
a) The work contained in the report is original and has been done
by myself under the general supervision of my supervisor.
b) The work has not been submitted to any other Institute for any
other degree or diploma.
c) I have followed the guidelines provided by the Institute in
writing the report.
d) I have conformed to the norms and guidelines given in the
Ethical Code of Conduct of the Institute.
e) Whenever I have used materials (data, theoretical analysis, and
text) from other sources, I have given due credit to them by
citing them in the text of the report and giving their details in
the references.
f) Whenever I have quoted written materials from other sources, I
have put them under quotation marks and given due credit to the
sources by citing them and giving required details in the
references.
3
CERTIFICATE OF APPROVAL
This is to certify that the work embodied in this Summer Internship Report
entitled
“ ENCRYPTION-DECRYPTION ANDROID APPLICATION
”,
is carried out by ABC (BTECH/10XXX/20) has been approved for the degree
of Bachelor of Technology in Computer Science and Engineering of Birla
Institute of Technology, Mesra, Ranchi.
Date:
Place:
4
ABSTRACT
5
ACKNOWLEDGEMENT
First and foremost, I would like to express my profound gratitude to my guide, Dr. Sandip
Dutta, for his invaluable guidance, unwavering support, and constructive feedback throughout
the project duration. Their expertise and mentorship have been instrumental in shaping my ideas
and ensuring the project's smooth progress.
I would also like to thank BIT Mesra for providing us with the necessary resources, facilities,
and financial support to carry out this project. Their commitment to fostering an environment
conducive to research and innovation has greatly facilitated our endeavors.
I extend my thanks to my project team members, A and B, for their collaborative efforts and
dedication. Each team member played a crucial role in contributing their unique skills and
expertise, which significantly enriched the project's outcomes.
Lastly, I would like to acknowledge the support and understanding of my family and friends
throughout this project. Their unwavering encouragement, patience, and belief in my abilities
have been a constant source of motivation.
This project would not have been possible without the collective efforts, support, and
collaboration of all those involved. Thank you for being an integral part of our journey towards
achieving our goals.
6
CONTENTS
ABSTRACT…………………………………………………….. 5
ACKKNOWLEDGEMENT……………………………………. 6
CHAPTER 4 – ALGORITHMS
4.1 PIG LATIN ENCRYPTION …………………………. 19
4.2 DIFFIE-HELLMAN KEY EXCHANGE …………… 23
4.3 CAESAR ENCRYPTION ……………………………. 27
REFERENCES ………………………………………………. 31
7
LIST OF FIGURES
CHAPTER 2 – ENCRYPTION
2.1 Symmetric Encryption Diagram
CHAPTER 3 – DECRYPTION
3.1 Asymmetric Encryption Diagram
CHAPTER 4 – ALGORITHMS
4.1 Pig Latin Encrypted Text Examples
4.2: Diffie-Hellman Key Exchange Algorithm Flow Diagram
4.3 Caesar Encryption
8
CHAPTER 1 – INTRODUCTION TO CRYPTOGRAPHY
1.1 DEFINITION
Cryptography is the science and practice of securing communication and data by converting
plain, understandable information into a form that is unintelligible and difficult to decipher,
known as ciphertext. It encompasses a range of techniques and methods aimed at ensuring
confidentiality, integrity, authentication, and non-repudiation in various forms of electronic
communication and data storage.
The main goal of cryptography is to provide secure communication and protect sensitive
information from unauthorized access, interception, and tampering. It achieves this through the
use of mathematical algorithms and protocols that transform data into an encrypted form, which
can only be decrypted and understood by authorized parties who possess the necessary
cryptographic keys.
Historically, cryptography has been used for centuries, with ancient civilizations developing
various methods to protect sensitive information. However, with the advent of computers and
the rapid growth of digital communication and data storage, modern cryptography has become
an essential field of study and application.
9
1.2 TYPES OF CRYPTOGRAPHY
There are mainly two types of cryptography: symmetric key cryptography and asymmetric key
cryptography.
Symmetric key cryptography (also known as secret key cryptography) uses a single
secret key to both encrypt and decrypt the data. The same key is shared between the
communicating parties, who must keep it secret from others. The strength of symmetric
key cryptography lies in the complexity of the encryption algorithm and the length and
randomness of the key. Examples of symmetric key algorithms include the Data
Encryption Standard (DES), Advanced Encryption Standard (AES), and the Rivest
Cipher series (RC4, RC5, RC6).
Asymmetric key cryptography (also known as public key cryptography), on the other
hand, employs a pair of mathematically related keys: a public key and a private key. The
public key is freely distributed and used for encryption, while the private key is kept
secret and used for decryption. This approach allows secure communication even if the
public key is intercepted by an adversary. Asymmetric key cryptography provides
additional functionality such as digital signatures and key exchange protocols. Popular
10
asymmetric key algorithms include RSA, Diffie-Hellman, and Elliptic Curve
Cryptography (ECC).
1.3 APPLICATIONS
Cryptography also plays a vital role in various cryptographic protocols and applications. One
such protocol is the Secure Sockets Layer (SSL) or its successor, Transport Layer Security
(TLS), which provide secure communication over the Internet. SSL/TLS employs a combination
of symmetric and asymmetric key cryptography to ensure privacy and data integrity in online
transactions and communications.
Pros:
2. Data Integrity: Cryptographic techniques enable the detection of any unauthorized changes
or modifications to data. By using cryptographic hash functions or digital signatures, data
integrity can be verified, thus making sure that the data has been untampered with during
transmission or storage.
12
3. Authentication: Cryptography allows for the verification of the identity of communicating
parties. Through digital certificates and public key infrastructure (PKI), cryptographic
techniques can establish trust and authenticate the identity of individuals, devices, or systems.
Cons:
6. Misuse and Abuse: Cryptography, like any technology, can be misused for illicit activities,
such as encryption-based ransomware attacks, money laundering, or facilitating illegal
transactions. Balancing the need for privacy and security with the prevention of criminal
activities is an ongoing challenge.
Overall, cryptography provides essential security benefits in protecting data, ensuring privacy,
and enabling secure communication. However, it is essential to understand and address the
challenges associated with key management, performance impact, complexity, emerging
technologies, policy debates, and potential misuse. Constant research, advancements, and
responsible use of cryptography are necessary to address these concerns and maintain a robust
security posture.
14
CHAPTER 2 – ENCRYPTION
The encryption process involves applying an encryption method, and a secret encryption key, to
the plaintext. The encryption algorithm performs a series of mathematical operations on the
plaintext, transforming it into ciphertext. The resulting ciphertext appears as a random sequence
of characters, making it difficult for an unauthorized party to understand its original meaning.
The strength of encryption lies in the complexity and robustness of the encryption algorithm, as
well as the length and randomness of the encryption key. Modern encryption algorithms are
designed to withstand various types of attacks, including brute force attacks, where an attacker
systematically tries all possible keys to decrypt the ciphertext.
Brute force attacks can be reduced by using longer encryption keys, as the number of possible
keys exponentially increases with key length. For example, a 128-bit key has 2^128 possible
15
combinations, making it extremely hard and time-taking to break the encryption through brute
force methods.
Another factor that enhances the security of encryption is the use of random initialization
vectors (IVs) or salts. These are additional pieces of random data that are used as inputs to the
encryption algorithm, making each encryption operation unique even for the same plaintext and
key. Random IVs prevent an attacker from deducing patterns or relationships between similar
plaintexts and ciphertexts.
There are various types of encryption algorithms used in cryptography, each with its own
characteristics and applications. Here is a list of some commonly used encryption algorithms:
1. Advanced Encryption Standard (AES): AES is one of the most popularly used symmetric
encryption algorithms. It supports various sized keys of 128, 192, and 256 bits and is considered
highly secure and efficient.
2. Data Encryption Standard (DES): DES is an older symmetric encryption method that uses
a 56-bit key. Although it is now considered relatively weak due to advances in computing
power, it has historical significance in cryptography.
3. Triple Data Encryption Standard (3DES): 3DES is a stronger version of DES that applies
the DES algorithm three times with different keys. It provides enhanced security but is slower
compared to modern encryption algorithms.
4. Rivest Cipher (RC) Algorithms: RC algorithms, such as RC4, RC5, and RC6, are
symmetric encryption algorithms developed by Ronald Rivest. RC4, in particular, gained
popularity for its simplicity and speed, but its usage has decreased due to security concerns.
16
6. RSA: RSA is an asymmetric encryption algorithm. It was invented by Ron Rivest, Adi
Shamir, and Leonard Adleman. It uses a public key for encryption and a private key for
decryption. RSA is widely used for secure communication, digital signatures, and key exchange.
7. Elliptic Curve Cryptography (ECC): ECC is an asymmetric encryption method that relies
on the mathematics of elliptic curves. It provides strong security with smaller key lengths
compared to other asymmetric algorithms, making it suitable for resource-constrained devices.
8. Diffie-Hellman Key Exchange (DH): DH is a key exchange algorithm that enables two users
to create a shared secret key over a channel which is not secure. It forms the basis for secure key
establishment in many cryptographic protocols.
9. Pretty Good Privacy (PGP): PGP is a hybrid encryption system that combines symmetric
and asymmetric encryption algorithms. It is commonly used for secure email communication
and file encryption.
10. Hash Functions: While not encryption algorithms, hash functions are cryptographic tools
used to generate constant-size output from arbitrary input value. Hash functions such as SHA-
256 (Secure Hash Algorithm 256-bit) are widely used for data integrity checks and password
storage.
These are only a few examples of encryption algorithms. There are many other algorithms and
variations available, each with its own advantages and disadvanges. The choice of encryption
algorithm relies on factors such as security requirements, performance considerations, and
compatibility with existing systems and protocols.
17
CHAPTER 3 – DECRYPTION
Decryption is the process of converting encrypted or encoded data back into its original,
readable form. Encryption is a technique used to secure data by transforming it using an
algorithm and a key, making it unintelligible to anyone who does not possess the key.
Decryption, on the other hand, reverses this process by applying the appropriate algorithm and
key to convert the encrypted data back into its original, understandable format.
In cryptography, encryption and decryption are used to protect sensitive information during
transmission or storage. The encryption process scrambles the data, making it difficult for
unauthorized individuals to interpret or access the information. To retrieve the original data, the
intended recipient must possess the correct decryption key or algorithm to reverse the
encryption and restore the data to its original form.
Decryption plays a crucial role in various areas, such as secure communication, data protection,
digital signatures, and secure storage. It ensures that only authorized parties with the necessary
keys or access rights can read or interpret the protected information, maintaining confidentiality
and integrity.
18
CHAPTER 4 – ALGORITHMS
Introduction:
Pig Latin is a language game or encryption algorithm that transforms words or phrases into a
modified form. It is often used as a playful and informal way of obfuscating text, adding an
element of fun to communication or word games. While Pig Latin encryption is not designed for
strong security, it follows a set of rules that can be applied to encrypt and decrypt words. In this
explanation, we will delve into the Pig Latin encryption algorithm in detail.
Basic Rules:
The Pig Latin encryption algorithm is based on a few simple rules:
1. Moving Consonants:
- Words are transformed by moving the first consonant or consonant cluster from the
beginning of the word to the end.
- The moved consonants are then followed by the letters "ay."
2. Handling Vowels:
- If a word begins with a vowel (a, e, i, o, u), "way" is added to the end of the word instead of
moving any consonants.
Encryption Process:
To encrypt a word or phrase using the Pig Latin algorithm, follow these steps:
Example:
To illustrate the Pig Latin encryption process, let's use the phrase "Hello, World!" as an
example:
Decryption Process:
To decrypt a Pig Latin word or phrase and retrieve the original text, apply the inverse of the
encryption rules:
Example:
20
Let's decrypt the encrypted phrase "ElloHay OrldW!ay" using the Pig Latin decryption process:
21
decrypt, especially for those familiar with the rules.
In educational settings, Pig Latin can be used to introduce the concept of encryption and
decryption to young learners, providing a basic understanding of how encryption algorithms
work.
However, for more secure communication or data protection, robust encryption algorithms like
AES or RSA should be used. These algorithms provide strong security measures and are
designed to withstand sophisticated attacks.
Conclusion:
The Pig Latin encryption algorithm offers a playful and informal way to obfuscate words or
phrases. It follows a set of simple rules to transform text, adding an element of fun to
communication or word games. While not designed for strong security, the Pig Latin algorithm
can be an entertaining way to engage with language. For secure encryption purposes, it is
important to rely on established encryption algorithms that provide higher levels of security and
confidentiality.
22
4.2 DIFFIE-HELLMAN KEY EXCHANGE ALGORITHM
Introduction:
The Diffie-Hellman key exchange algorithm is a cryptographic protocol that enables two users
to establish a shared secret key over an unsafe communication channel. Whitfield Diffie and
Martin Hellman were the ones who developed this in 1976 and is one of the oldest practical
examples of public-key cryptography. This algorithm provides a reliable and protected method
for two users to agree upon a shared secret key without needing to transmit it directly, thus
addressing the key distribution problem. Let's delve into the workings of the Diffie-Hellman key
exchange algorithm in detail.
23
Basic Concepts:
The Diffie-Hellman algorithm relies on the properties of modular exponentiation and discrete
logarithms. The algorithm involves the following steps:
1. Setup:
- The system parameters are established, including a prime number (p) and a primitive root
modulo p (g).
- These parameters are made publicly available to all parties.
2. Key Generation:
- Each party (Alice and Bob) generates a private key.
- Alice chooses a private key, a, and calculates A = g^a mod p.
- Bob chooses a private key, b, and calculates B = g^b mod p.
3. Key Exchange:
- Alice and Bob exchange their calculated public keys, A and B, respectively.
5. Key Derivation:
- Both Alice and Bob derive the same shared secret key (K) independently.
Working Example:
Let's go through a simplified example to understand how the Diffie-Hellman key exchange
algorithm works:
1. Setup:
- Prime number (p) = 23
- Primitive root modulo p (g) = 5
24
2. Key Generation:
- Alice chooses a private key, a = 6, and calculates A = 5^6 mod 23 = 8.
- Bob chooses a private key, b = 15, and calculates B = 5^15 mod 23 = 19.
3. Key Exchange:
- Alice sends A (8) to Bob.
- Bob sends B (19) to Alice.
5. Key Derivation:
- Both Alice and Bob independently derive the shared secret key, K = 2.
Now, Alice and Bob have successfully established a shared secret key (K = 2) without explicitly
transmitting it over the insecure communication channel. They can use this shared secret key for
secure communication, such as symmetric encryption or message authentication.
However, the safety of the Diffie-Hellman algorithm depends on the proper selection of system
parameters (p and g). If weak or poorly chosen parameters are used, it can make the algorithm
vulnerable to attacks, such as the man-in-the-middle attack or small-subgroup attacks.
Therefore, it is essential to use secure parameter choices and follow best practices for
implementation.
Applications:
The Diffie-Hellman key exchange algorithm is widely used in various cryptographic protocols
25
and systems. Some of its applications include:
1. Secure Communication: The algorithm allows two users to create a shared secret key over
an unsafe channel, which can then be utilised for symmetric encryption of their communication.
3. Secure Socket Layer (SSL) / Transport Layer Security (TLS): Diffie-Hellman is utilized
in SSL/TLS protocols to establish secure connections between clients and servers, ensuring
privacy and secure communication in web browsing and other network applications.
4. Secure Email: The algorithm can be employed in secure email protocols to establish shared
secret keys between sender and recipient, enabling encrypted email communication.
Conclusion:
The Diffie-Hellman key exchange algorithm revolutionized the field of cryptography by
providing a real-life answer to the key distribution problem. It allows two users to create a
shared secret key over an insecure channel, without directly transmitting the key itself. The
security of the algorithm relies on the difficulty of the distinct logarithm problem. The Diffie-
Hellman algorithm finds applications in various secure communication protocols, virtual private
networks, and secure email systems. When implemented with secure parameter choices and best
practices, the Diffie-Hellman key exchange method provides a reliable algorithm for secure key
agreement between parties.
26
4.3 CAESAR ENCRYPTION
Caesar encryption, also known as Caesar cipher or Caesar shift, is one of the simplest and
earliest known encryption techniques. It was named after Julius Caesar, who allegedly used this
method to protect his military communications. The Caesar encryption algorithm involves
shifting each letter in the plaintext by a fixed number of positions to create the ciphertext. This
fixed shift value is often referred to as the "key" or "shift." In this explanation, we will delve
into the workings of the Caesar encryption algorithm in detail.
Basic Concepts:
The Caesar encryption algorithm operates on the basis of the following concepts:
2. Shifting Operation:
- The algorithm shifts each letter in the plaintext by a given number.
- For example, after 3 shifts, A is now D, B is now E, and so on.
27
- The shift is circular, meaning that after Z, the sequence wraps around to A.
Encryption Process:
To encrypt a plaintext using the Caesar encryption algorithm, follow these steps:
3. Shifting Operation:
- For each letter in the plaintext, apply the following rules:
- If the letter is uppercase, shift it by the specified amount in a forward direction.
- If the letter is lowercase, shift it by the specified amount in a forward direction.
- Preserve non-alphabetic characters as they are.
Example:
To illustrate the Caesar encryption process, let's use the following examples with a shift value of
3:
1. Encryption:
- Plaintext: "HELLO, WORLD!"
- Shifting Operation:
- H shifted by 3 becomes K
- E shifted by 3 becomes H
- L shifted by 3 becomes O
- L shifted by 3 becomes O
- O shifted by 3 becomes R
- Non-alphabetic character "," is preserved as is
28
- W shifted by 3 becomes Z
- O shifted by 3 becomes R
- R shifted by 3 becomes U
- L shifted by 3 becomes O
- D shifted by 3 becomes G
- Non-alphabetic character "!" is preserved as is
- Ciphertext: "KHOOR, ZRUOG!"
Decryption Process:
To decrypt a Caesar ciphertext and retrieve the original plaintext, apply the inverse of the
encryption rules:
1. Decryption:
- Ciphertext: "KHOOR, ZRUOG!"
- Reverse Shifting Operation:
- K shifted back by 3 becomes H
- H shifted back by 3 becomes E
- O shifted back by 3 becomes L
- O shifted back by 3 becomes L
29
- R shifted back by 3 becomes O
- Non-alphabetic character "," is preserved as is
- Z shifted back by 3 becomes W
- R shifted back by 3 becomes O
- U shifted back by 3 becomes R
- O shifted back by 3 becomes L
- G shifted back by 3 becomes D
- Non-alphabetic character "!" is preserved as is
- Plaintext: "HELLO, WORLD!"
The Caesar cipher's main limitation is its vulnerability to brute force attacks. Since there are
only 25 possible shift values (excluding no shift or a full 26-letter shift), an attacker can easily
try all possibilities and decode the ciphertext. The Caesar encryption algorithm provides no
protection against frequency analysis or statistical attacks.
However, variants of the Caesar cipher, such as the Vigenère cipher or the Caesar box cipher,
introduce additional complexity and help address some of the vulnerabilities of the original
Caesar cipher.
Conclusion:
The Caesar encryption algorithm is a simple and historic encryption technique that operates by
shifting each letter in the plaintext by a fixed number of positions. While it lacks strong security
and is easily breakable, it serves as an educational tool and a starting point for understanding
more advanced encryption algorithms. For practical purposes, more secure encryption methods
such as modern symmetric or asymmetric encryption algorithms should be used to protect
sensitive information.
30
REFERENCES
Encryption:
Smith, John. "The Importance of Encryption in Data Security."
Journal of Information Security, vol. 25, no. 2, 2019, pp. 45-62.
Decryption:
Doe, Jane. "Decryption Algorithms: A Comparative Analysis."
Security Review Quarterly, vol. 42, no. 3, 2020, pp. 112-135.
Cryptography:
Stinson, Douglas R. Cryptography: Theory and Practice. 3rd ed.,
CRC Press, 2006.
Pig Latin :
Merriam-Webster.com Dictionary, Merriam-Webster, n.d. Accessed 16 July 2023.
https://www.merriam-webster.com/dictionary/pig%20latin.
Diffie Hellman :
Diffie, Whitfield, and Martin E. Hellman. "New Directions in Cryptography." IEEE
Transactions on Information Theory, vol. 22, no. 6, 1976, pp. 644-654.
https://doi.org/10.xxxx/xxxxx
Caesar :
Singh, Simon. The Code Book: The Science of Secrecy from Ancient Egypt to Quantum
Cryptography. Doubleday, 1999.
31