Open In App

Cryptography and its Types

Last Updated : 07 Aug, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

Cryptography is a technique of securing information and communications using codes to ensure confidentiality, integrity and authentication. Thus, preventing unauthorized access to information. The prefix "crypt" means "hidden" and the suffix "graphy" means "writing". In Cryptography, the techniques that are used to protect information are obtained from mathematical concepts and a set of rule-based calculations known as algorithms to convert messages in ways that make it hard to decode them.

crptography

These algorithms are used for cryptographic key generation, digital signing, and verification to protect data privacy, web browsing on the internet and to protect confidential transactions such as credit card and debit card transactions.

Features Of Cryptography

The features of cryptography that makes it a popular choice in various applications could be listed down as

features_of_cryptography
  1. Confidentiality: Information can only be accessed by the person for whom it is intended and no other person except him can access it.
  2. Non-repudiation: The creator/sender of information cannot deny his intention to send information at a later stage.
  3. Integrity: Information cannot be modified in storage or transition between sender and intended receiver without any addition to information being detected.
  4. Adaptability: Cryptography continuously evolves to stay ahead of security threats and technological advancements.
  5. Interoperability: Cryptography allows for secure communication between different systems and platforms.
  6. Authentication: The identities of the sender and receiver are confirmed. As well destination/origin of the information is confirmed.

Working of Cryptography

As we all know that cryptography technique is use to convert plain text into ciphertext. This technique is done by cryptographic key. Basically cryptographic key is a string of characters which is used to encrypts the data and decrypt the data.

cryptography

Here,

"Hello" is a plaintext and convert into ciphertext "jknnq" with the help of cryptographic key and then decrypt into "Hello".

Types Of Cryptography

There are three types of cryptography, namely Symmetric Key Cryptography, Asymmetric Key Cryptography and Hash functions, here's a detailed explanation below:

Types-of-Cryptography

1. Symmetric Key Cryptography

Symmetric Key Cryptography is an encryption system where the sender and receiver of a message use a single common key to encrypt and decrypt messages. Symmetric Key cryptography is faster and simpler but the problem is that the sender and receiver have to somehow exchange keys securely. The most popular symmetric key cryptography systems are Data Encryption Systems (DES) and Advanced Encryption Systems (AES) .

Symmetric Key Cryptography
Symmetric Key Cryptography

Example:

1. Data Encryption Standard (DES)

DES (Data encryption standard) is an older encryption algorithm that is used to convert 64-bit plaintext data into 48-bit encrypted ciphertext. It uses symmetric keys (which means same key for encryption and decryption). It is kind of old by today’s standard but can be used as a basic building block for learning newer encryption algorithms.

Data-Encryption-Standard

Example of DES Encryption and Decryption tool:

2. AES (Advanced Encryption Standard):

AES s a popular encryption algorithm which uses the same key for encryption and decryption It is a symmetric block cipher algorithm with block size of 128 bits, 192 bits or 256 bits. AES algorithm is widely regarded as the replacement of DES (Data encryption standard) algorithm.

AES-vs-DES-encryption_

Example for Encryption and Decryption of AES tool.

Hash Functions

Hash functions do not require a key. Instead, they use mathematical algorithms to convert messages of any arbitrary length into a fixed-length output, known as a hash value or digest. Hash functions are designed to be one-way, meaning the original input cannot be derived from the output. Given Below, Some of the most widely used hash functions include:

SHA-1:

SHA-1 stands for Secure Hash Algorithm 1. It is a cryptographic hash function developed by the National Security Agency (NSA) and published by NIST in 1995. It was designed to ensure data integrity by converting any input into a fixed-size 160-bit (20-byte) hash value.

SHA1
SHA-1

Example of SHA-1 Hash Generator

sha-1
Example

SHA-256:

The SHA-256 algorithm belongs to the family of the SHA 2 algorithms. It generates a fixed 256-bit (32-byte) hash value from input data of any length. It is widely used in various security applications, including data integrity verification, digital signatures, blockchain technology, and password hashing, due to its strength and resistance to known cryptographic attacks.

sha_256
SHA-256
Example:
Data : geeksforgeeks
SHA256 : f8d59362da74ffe833332dc20508f12de6da6a9298c98b3b42873e7298fced78

MD5:

MD5 produces a 128-bit hash value (32-character hexadecimal number) from input data of any size. Originally designed for data integrity verification, MD5 was widely used for checksums, digital signatures, and file verification. It is developed by Ronald Rivest in 1991.

MD5-Hashing
MD5

MD6:

MD6 is a cryptographic hash function designed by Ronald Rivest and his team in 2008 as a successor to the MD5 and MD4 algorithms. It was created to be highly secure and suitable for modern computing systems, including multi-core processors.

MD6-Hashing
MD6 Hashing

Example of MD6 Hash Generator

md6
Example

3. Asymmetric Key Cryptography

In Asymmetric Key Cryptography a pair of keys is used to encrypt and decrypt information. A sender's public key is used for encryption and a receiver's private key is used for decryption. Public keys and Private keys are different. Even if the public key is known by everyone the intended receiver can only decode it because he holds his private key. The most popular asymmetric key cryptography algorithm is the RSA algorithm.

Asymmetric Key Cryptography
Asymmetric Key Cryptography

Examples:

RSA (Rivest-Shamir-Adleman):

RSA is an basic asymmetric cryptographic algorithm which uses two different keys for encryption. The RSA algorithm works on a block cipher concept that converts plain text into cipher text and vice versa.

how_rsa_encryption_works
Encryption in RSA

Example:

Choose p = 3 and q = 11
Compute n = p * q = 3 * 11 = 33
This n is part of the public key and also used in both encryption and decryption
Computer Euler's function φ(n)
ϕ(n)=(p−1)(q−1)=(3−1)(11−1)=2×10=20
Choose e such that 1 < e < φ(n) and e and φ (n) are coprime. Let e = 7
Compute a value for d such that (d * e) % φ(n) = 1. One solution is d = 3 [(3 * 7) % 20 = 1]
Public key is (e, n) = (7, 33)
Private key is (d, n) = (3, 33)

Encyption:
Let’s say the message M=4 (must be < n)
Ciphertext C=M^e modn=4^3 mod33=64 mod33=31
Encrypted Message = 31

Decryption:
M=C^d modn=31^7 mod33
Use modular Exponential
  • 31^2 = 961 mod33=4
  • 31^4 = (31^2)^2 = 16
  • 31^7 = 31.31^2.31^4 = 31.4.16 = 1984 mod 33

Now, 1984 mod 33 = 4

Decrypted Message= 4

ECC (Elliptic Curve Cryptography):

lliptic Curve Cryptography (ECC) is a type of asymmetric encryption that provides strong security with smaller keys than RSA. It’s efficient, fast, and ideal for devices with limited resources like smartphones, IoT devices, and blockchain wallets. ECC is widely used in secure communications such as TLS/SSL and cryptocurrencies due to its lightweight yet powerful encryption.

curve
Elliptic Curve

Equation:

We use the standard elliptic curve equation: y^2 = x^3 + ax + b mod p
Let's choose:
  • Prime field: p =23
  • Curve parameters: a = 1, b = 1

So the curve becomes: y^2 = x^3 + x + 1 mod 23

Applications of Cryptography

Cryptography has wide area of applications in the modern world, where the technology is rapidly evolving. From authentication measures to cryptocurrencies, cryptography is here to stay, these are some of the most common applications of cryptography listed below:

applications_of_cryptography
Applications
  • Computer passwords: Cryptography is widely utilized in computer security, particularly when creating and maintaining passwords. When a user logs in, their password is hashed and compared to the hash that was previously stored. Passwords are hashed and encrypted before being stored. In this technique, the passwords are encrypted so that even if a hacker gains access to the password database, they cannot read the passwords.
  • Digital Currencies: To protect transactions and prevent fraud, digital currencies like Bitcoin also use cryptography. Complex algorithms and cryptographic keys are used to safeguard transactions, making it nearly hard to tamper with or forge the transactions.
  • Secure web browsing: Online browsing security is provided by the use of cryptography, which shields users from eavesdropping and man-in-the-middle assaults. Public key cryptography is used by the Secure Sockets Layer (SSL) and Transport Layer Security (TLS) protocols to encrypt data sent between the web server and the client, establishing a secure channel for communication.
  • Electronic Signatures: Electronic signatures serve as the digital equivalent of a handwritten signature and are used to sign documents. Digital signatures are created using cryptography and can be validated using public key cryptography. In many nations, electronic signatures are enforceable by law, and their use is expanding quickly.
  • Authentication: Cryptography is used for authentication in many different situations, such as when accessing a bank account, logging into a computer, or using a secure network. Cryptographic methods are employed by authentication protocols to confirm the user's identity and confirm that they have the required access rights to the resource.
  • Cryptocurrencies: Cryptography is heavily used by cryptocurrencies like Bitcoin and Ethereum to protect transactions, thwart fraud, and maintain the network's integrity. Complex algorithms and cryptographic keys are used to safeguard transactions, making it nearly hard to tamper with or forge the transactions.
  • End-to-end Internet Encryption: End-to-end encryption is used to protect two-way communications like video conversations, instant messages, and email. Even if the message is encrypted, it assures that only the intended receivers can read the message.  End-to-end encryption is widely used in communication apps like WhatsApp and Signal, and it provides a high level of security and privacy for users.

Classical Ciphers

Ciphers are methods used to transform readable data (plaintext) into unreadable data (ciphertext) so that only authorized parties can understand the original content.

cipher
Cipher

Examples

  • Military/Spying - Early secret communication (e.g., Enigma machine)
  • CTFs / Hack Challenges - Puzzles often hide flags using classical ciphers
  • Legacy malware - Obfuscates payloads using simple XOR or Caesar ciphers

Categories of Ciphers:

There are mainly two types of Classical Ciphers

1. Substitution Ciphers: Replace characters with other characters using a defined rule

Example:

In Caesar Cipher, A → D, B → E, etc.

Real-Life Use: Simple password obfuscation, CTFs, and puzzle challenges.

2. Transposition Ciphers: Rearrange the order of characters without changing them.

Example:

Rail Fence Cipher, where characters are written in a zigzag and read row by row.

Real-Life Use: Basic message encoding to confuse readers.

Types of Classical Ciphers

There are basic types of Classical Ciphers.

Cipher NameDescriptionReal-life/CTF Use
Caesar CipherEach letter is shifted a fixed number of places.Hidden messages in simple malware, games, or emails.
Vigenère CipherUses a keyword to shift letters; more secure than Caesar.Used in older secret messages and CTF puzzles.
Atbash CipherA → Z, B → Y… Reverses the alphabet.Often seen in basic stego/crypto challenges.
ROT13A Caesar Cipher with a shift of 13.Used in hiding spoilers or light obfuscation online.
Rail Fence CipherA form of transposition cipher that rearranges the order.Great for simple puzzles and password hiding.


Steganography

Steganography is the practice of concealing information. It involves hiding data within an ordinary, non-secret file or message to prevent detection. The hidden information is being extracted at the receiving end. Often, steganography is combined with encryption to add an extra layer of security for the hidden data. With the help of Steganography, we can hide any digital content virtually like text, image, videotape, etc.

Common Types of Steganography:

Here are the types mentioned below about Steganography

Image Stego (LSB)

  • Data is hidden in the least significant bits of pixels.
  • Real-Life Use: Malware communication, CTF challenges.

Text Stego

  • Secret data hidden using invisible characters, spaces, or misspelled words.
  • Real-Life Use: Covert communication in censored countries.

Audio Stego

  • Hidden messages embedded in audio signals, often inaudible.
  • Real-Life Use: Watermarking or espionage.

Video Stego

  • Embeds information in video frames or metadata.
  • Real-Life Use: Covert data exfiltration techniques.

Metadata Stego

  • Stores data in metadata fields (e.g., EXIF data in images).
  • Real-Life Use: Hiding payload links in innocent-looking files.
steno
Steganography

Tools for Stego Practice:

Here are the basic tool of Steganography

ToolUse
SteghideHide/extract data from images/audio
zstegAnalyze PNG/BMP for hidden messages
ExifToolExtract hidden metadata in images
binwalkExtract hidden content in binaries
stringsFind readable data inside files
stegsolve.jarGUI tool to analyze and dissect images

Hands-On Practice

Lets try ciphering a phrase and how it works.

  • User CyberChef to encode the plaintext, and use correct operations to Encode/Decode Cipher.
  • Types Cipher> Drag Caesar Cipher box into Recipe > Type "Hello Friends" in Input field > Change Box height
  • You will notice that the output will change as you change the box height, but at a point you will be able to view the phrase Hello friends in the output box again.

Similar Reads