Cryptography and its Types

Last Updated : 12 Dec, 2025

Cryptography is the science of protecting information using mathematical techniques to ensure confidentiality, integrity, and authentication. It transforms readable data into unreadable form, preventing unauthorized access and tampering.

  • Converts plaintext into ciphertext using algorithms and keys
  • Ensures confidentiality, integrity, authentication, and non-repudiation
  • Used in secure communication, digital signatures, passwords, and online transactions

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".
  • Plaintext is created
    The original readable message or data.
  • A cryptographic algorithm is chosen
    Example: AES, RSA, SHA-256, etc.
  • A key is applied
    This key controls how the encryption or hashing is performed.
  • Encryption converts plaintext → ciphertext
    The data becomes unreadable to unauthorized users.
  • Ciphertext is transmitted or stored securely
    Even if intercepted, it cannot be understood without the correct key.
  • Decryption converts ciphertext → plaintext
    The receiver uses the correct key (same key for symmetric, different for asymmetric).
  • Integrity checks may be used
    Hashing ensures the message has not been altered.

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:

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:

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.

2. 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.
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. These are some of the most common applications of cryptography listed below:

applications_of_cryptography
Applications

1. Password Security: Passwords are hashed before storage to prevent exposure even if the database is leaked.

2. Digital Currencies: Bitcoin and other cryptocurrencies use cryptography for transaction integrity and identity protection.

3. Secure Web Browsing (HTTPS): SSL/TLS protocols encrypt communication between browser and server.

4. Electronic Signatures: Legally valid digital signatures created using public-key cryptography.

5. Authentication Systems: Used in bank logins, secure networks, and access control systems.

6. End-to-End Encryption: Messaging apps like WhatsApp and Signal ensure only intended users read the messages.

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.
Comment

Explore