Modern Cryptography
Modern Cryptography
Abstract: Modern Cryptography refers to the study of secure communication techniques that are used in the digital age. It involves the use of
mathematical algorithms and protocols to protect the confidentiality, integrity, and authenticity of information as it is transmitted over networks or stored
on devices. This paper dives into the techniques used in modern-day cryptography to aid in data secrecy. It outlines different approaches used in modern-
day cryptography techniques. It majorly informs us about different approaches to cryptography, their types, and the algorithms used. We have explored
multiple cryptography techniques such as symmetric, asymmetric, and touched hashing as well. We have dived into their working mechanisms and
algorithms to complement the covered topics.
Index Terms: Plain Text, Cryptography, Cipher Text, Keys, Encryption, Decryption.
confidential. The algorithm first takes the seed value and the initial input to
produce output bytes. And then repeatedly uses the output bytes
Examples of Algorithms: Examples of cryptography from each preceding function iteration to calculate new bytes until
Substitution, Transposition, types are Hash function, no input bytes are left.
etc. Symmetric Encryption,
Asymmetric Encryption, etc. This is just a vague generalization of hash functions but we must
understand the working algorithm.
Uses For the above-mentioned reason, even a single-bit input difference
will yield a completely different hash output.
Cryptography is used almost everywhere in this day and age. There
is almost no place where cryptography is not used. From IoT to the Properties:
servers that provide 24/7 communications, cryptography is used in
some form or another. • Preimage resistance: This property of the hash function
should make it computationally infeasible to reverse the hash
Even the algorithms to secure the bits are built into the chips
output back to its input. In other words, if someone tries to
themselves, for example, C.P.U, R.A.M. It contains some
convert the output back to the input, it should be close to
mechanisms to prevent the malicious actor from gaining
impossible to reverse.
unauthorized access to its internal processing data. Even though it is
built into the OS itself, the point still stands.
• Second Pre-Image Resistance: This property of any hash In other words, encryption is the process of scrambling the clear
function states that for any given input and its hash value. It text in such a way that the obtained output cannot be understood by
should be extremely hard to find the same hash with different the party other than who is authorized to read it.
input values.
Operating Principle:
• Collision Resistance: This property of the hash function ensures
that it should be hard to have two different inputs of varying Here is a general overview of how the encryption process works.
lengths that produce the same output hash value. In other words, Please note that this is just a simple explanation of the steps
this property ensures that the hash function is collision-free. involved in encryption. The actual implementation depends on the
algorithm used and its mode of operation.
Popular Hash Functions Step #1. Generate a random nonce to randomize the output of the
The modern-day hash functions that are widely accepted and algorithm.
implemented are: Step #2. Generate a random encryption key or derive it from the
user input such as a password.
1. Message Digest (MD) Step #3. Apply multiple rounds of mathematical calculations or
algorithms such as transposition, shifting and XORring.
It is a family suite of multiple hash functions such as MD2, MD4, Step #4. Produce the cipher text to be used later for decryption.
MD5, and MD6. The implementation standard is also mentioned
in the Internet Standard RFC 1321. The MD5 hash function was Types
very popular in the recent past. The output of the hash functions in
this family includes a fixed length 128-bit value. It was generally There are two types of encryption in modern cryptography. They
used to generate the integrity verification hash for software are explained below:
distributions.
However, in 2004 cases of hash collisions were detected by security i. Symmetric Key Encryption
experts. Hence, it is no longer considered secure for scaled Symmetric encryption is the category of encryption that utilizes the
enterprise usage. same key for both encryption and the decryption process. In this
2. Secure Hash Functions (SHA) type of encryption one single key is used for both encryption and
decryption.
SHA is also a family of four hash functions. The four hash
functions in SHA are SHA-0, SHA-1, SHA-2, and SHA-3. The Here is a list of common encryption algorithms in symmetric key
SHA family has varying bits output in each of them. encryption: DES, 3DES, AES, IDEA, RC4, and RC5.
SHA-0 did not get as popular as other recent variants. It is because We can denote the encryption and decryption process with a
SHA-0 had many issues. Out of which, many issues were solved in symmetric algorithm as:
SHA-1 and it is the most used version of SHA. Even the SSL suite
uses SHA-1 for its proper functionality. However, a method to EK(M) = C (the cipher text)
generate collisions was found in 2005 for SHA-1. Which made the DK(C) = M (the plain text)
experts make new versions of SHA for long-term reliability. Hence,
SHA-2 and SHA-3 are introduced as recent additions. In symmetric key encryption, two modes or operation are used. The
mode of operation is how the algorithm operates with the input
3. RIPEMD (RACE Integrity Primitives Evaluation Message data. The two modes of operation used in symmetric key encryption
Digest) are described below:
It is a hash function that was generated by the open research
• Stream Cipher
community of the European Hash Function. The family includes
RIPEMD, RIPEMD-128, and RIPEMD-160. In this mode of operation, the input data is directly processed
The algorithm for RIPEMD-128 uses the same principles which byte by byte. The algorithm directly takes the input character
were used in MD4. Which was produced as a result to solve the and converts it into the cipher text using the specified
issues and vulnerabilities in the original RIPEMD implementation. encryption key. Due to the nature of this algorithm, the
The latest addition to the suite is RIPEMD-160 is the most widely operation uses 8 bits (in AES) to perform encryption.
used version because it has improved in many different areas of its
Stream ciphers are generally complex but in contrast, they are
implementation.
not as secure as block ciphers. But they are fast compared to
II. Encryption block ciphers because they deal with the input data directly to
produce cipher texts. Some common examples of stream
Encryption is the process of obtaining the ciphertext after applying
ciphers are Salsa20, RC4, etc.
an encryption algorithm with an encryption key to the plaintext to
conceal insecure information from everyone. • Block Cipher
In this mode of operation, the input data is broken down into blocks The decryption of the AES encryption is performing the same
of bits ranging from 64 bits to 512 bits or more. The algorithm breaks above operations but in reverse order.
down the plaintext into blocks of bits and applies multiple rounds of
Example: The AES encryption example shown below is performed
arithmetic operations such as transposition, shifting, and XORing.
online here (https://www.devglan.com/online-tools/aes-
The internal working mechanism for each algorithm might vary but encryption-decryption). The output is Base64 encoded string which
the general principle remains the same. Examples of block ciphers can be converted to actual byte output if we wish.
are AES, DES, and 3DES.
Let us look at the most widely used symmetric key encryption
algorithm (AES).
AES (Advanced Encryption standard)
AES is the most advanced and cryptographically secure algorithm
used for symmetric encryption. It is also
sometimes known as Rijndael encryption because it is based on the
algorithm of the same name. It is faster than most other algorithms
such as Feistel, 3DES, etc.
Operation: The AES is a bit different from other algorithms because
it breaks down the input into blocks of bits. However, it performs
calculations on bytes rather than bits. Meaning the 128-bit block will
only be treated as a 16-byte block for all the operations.
Also, in the 128-bit mode, the algorithm does a 10-round calculation,
12 rounds for 192-bit keys, and 14 rounds for 256-bit keys. Each
round of operation will have a different key for its operation known
as a round key.
Let’s take an example of 128 bits (16 bytes) to see how the operations
are performed in AES.
Byte substitution: The 16 bytes are replaced by observing a static
table provided in the design of the algorithm. The resulting output ii. Asymmetric Key Encryption
will be a matrix of 4x4.
Asymmetric encryption is also sometimes referred to as Public Key
Shiftrows: In this step of the operation each row of the matrix moved encryption. It is called so because in this mode of encryption a pair
to the left. If the values do not lie in the table, then they are inserted of keys are used. One key is used for encrypting the data and the
to the other side while shifting. Here are the steps which are other is used for decryption.
performed during the shiftrows:
In this type of encryption, the plaintext is generally encrypted using
● The very 1st row is not altered (shift).
the Public Key and later the Private Key is used for the decryption
● The 2nd row is altered (shift) by one byte or one row.
process. The asymmetric encryption type also includes multiple
● The 3rd row is altered (shift) by two places to the left.
algorithms. The usage of one type of algorithm entirely depends on
● The 4th row is moved three places to the left.
what you want to use the mode of encryption for.
After performing the above operations, the resulting matrix is a new
matrix with identical contents but shifted according to one another. The first public key algorithm to be publicly disclosed was the
Diffie Hellman key exchange. After some time, the RSA (Rivest
MixColumns: This is another step in the AES encryption operation.
Shamir Addleman) algorithm was also publicly made available.
Each column is now converted by utilizing a mathematical function.
The function receipts four bytes from each column and produces a
Uses
new output after applying mathematics, which replaces the main
Asymmetric key encryption is generally used to encrypt and send
column. Another matrix consists of 16 bytes to collect the result.
plaintext from the public domain for example PGP. It can also be
Addroundkey: This is the last operation in the AES encryption. Now used to create digital signatures by using the private key during the
the algorithm considers the 16 bytes as 128 bits. Then, an XOR encryption process. In fact, digital signatures are created exactly
operation is performed between the bytes and the round key. If this this way.
is the ending round then the ciphertext is given out else the process In practice asymmetric encryption is used only to encrypt short
is repeated. plain texts, this is because the algorithm is inherently slow. It will
not be practical to use the RSA algorithm to encrypt larger plaintext medium.
for normal usage.
Encryption
So, in practice, a hybrid approach is used whenever asymmetric
This is the step where the actual plain text is converted to the cipher
encryption is required. The faster symmetric encryption is carried out
text. The process involved in this step are:
to encrypt the information and later the asymmetric algorithm is used
to encrypt the key used for the encryption in symmetric encryption. ● The public key used for encryption is identified.
● The public key is used to encrypt the plaintext
There are multiple types of algorithms for asymmetric key
encryption: RSA, DSA ECC. Let us look at how the RSA algorithm Decryption
works.
The decryption of the encrypted cipher text obtained from the
RSA (Rivest Shamir Addleman) above step can be done using the private key. The private key is the
key pair of the public key used to encrypt the plain text.
This algorithm was advanced by Ron Rivest, Leonard Addleman, and
Adi Shamir at MIT in 1977. And today it is the most widely used
III. Decryption
algorithm in asymmetric key cryptography. It is fast and secure in its
mode of operation. Decryption is the process of taking encoded or encrypted data and
converting it back into its original form. This is done with a
Operating Principles
decryption key, which is used to reverse the process of encryption.
The working mechanism of RSA is fairly simple to understand. It is the reverse process, converting the encrypted data (cipher text)
However, the actual computation involved is rather complex as it into its original form (normal text).
involves prime numbers and modulo operation.
We can break down the overall operation into four simple steps to Preferences of Cryptography Types
understand it better. From the above sections, we learned that there are multiple
Key generation approaches to cryptography such as hashing, encryption, digital
signatures, etc.
The first step to encryption with RSA is key generation. The key
generation logic is shown in the image below: Let us look at the comparisons of each encryption type. [2]
Hash Functions
References
[1] Schneier, B. (1995). Part II—Cryptographic Techniques. In
Applied cryptography. essay, John Wiley.