Introduction of cryptography

Comprehensive study notes, diagrams, and exam preparation for Introduction of cryptography.

Introduction of Cryptography

Definition

Cryptography is the branch of computer science and mathematics that deals with securing information by transforming plaintext into ciphertext and back again using algorithms and keys, so that only authorized users can access or verify the data.

In simple terms, cryptography is the method of protecting data through encoding techniques that make information unreadable to outsiders unless they possess the correct key or method to decode it. It is used to secure messages, files, transactions, passwords, and digital identities.


Main Content

1. Basic Concepts of Cryptography

Plaintext and Ciphertext

  • Plaintext is the original readable message or data, while ciphertext is the encrypted form of that message. For example, the message “HELLO” may be transformed into a meaningless string like “XJQ12” using encryption.

Encryption and Decryption

  • Encryption is the process of converting plaintext into ciphertext, and decryption is the reverse process of converting ciphertext back into plaintext. These processes use cryptographic algorithms and keys.

Key

  • A key is a secret value used in the encryption and decryption process. The strength of a cryptographic system often depends on the secrecy and length of the key.

Cryptography works by combining data with a key using a mathematical algorithm. The algorithm defines how the transformation occurs, while the key determines the exact output. For example, if two users want to communicate securely, both may use the same secret key in symmetric cryptography, or they may use a pair of public and private keys in asymmetric cryptography.

A simple example is the Caesar cipher, where each letter is shifted by a fixed number of places in the alphabet. If the shift is 3, then A becomes D, B becomes E, and so on. Though very weak by modern standards, this illustrates the basic idea of encryption.


2. Types of Cryptography

Symmetric-Key Cryptography

  • The same key is used for both encryption and decryption. This method is fast and efficient, making it suitable for encrypting large amounts of data. Examples include AES and DES.

Asymmetric-Key Cryptography

  • This method uses a pair of keys: a public key for encryption and a private key for decryption. It is commonly used for secure key exchange, digital signatures, and secure communication. Examples include RSA and ECC.

Hash-Based Cryptography

  • Hash functions transform data into a fixed-length digest or hash value. Hashing is one-way, meaning the original data cannot easily be recovered from the hash. It is used for password storage, data integrity, and digital fingerprinting.

Symmetric cryptography is generally faster, but it requires safe key sharing. Asymmetric cryptography solves the key-sharing problem but is slower and more computationally expensive. Hashing is different from encryption because its purpose is not to hide data for recovery, but to verify that data has not changed.

For example, when you log in to a website, your password is usually hashed and compared with the stored hash rather than being decrypted. Similarly, when a file is downloaded, its hash may be checked to ensure it was not tampered with during transfer.


3. Goals and Security Services of Cryptography

Confidentiality

  • Ensures that only authorized users can read the information. This is achieved through encryption.

Integrity

  • Ensures that the data has not been modified in transit or storage. Hash functions and message authentication codes help provide this service.

Authentication and Non-Repudiation

  • Authentication verifies identity, while non-repudiation prevents a sender from denying that they sent a message. Digital signatures are commonly used for this purpose.

The main purpose of cryptography is not just secrecy. In a secure communication system, a user should be able to trust that the message truly came from the claimed sender and that the message was not altered. For example, if a bank sends a transaction confirmation, cryptography can prove that the message came from the bank and was not changed by an attacker.

A practical illustration is secure email. Encryption protects the content from being read by others, hash functions help detect tampering, and digital signatures confirm the sender’s identity. Together, these techniques create a secure and reliable communication environment.


Working / Process

1. Plaintext is prepared

  • The original message or data is selected for protection. This may be text, a file, a password, or a transaction record.

2. An algorithm and key are applied

  • The cryptographic method uses the key to transform plaintext into ciphertext or to generate a hash/signature.

3. The protected data is transmitted or stored

  • The ciphertext or protected value is safely sent or stored, and only authorized users with the proper key or verification method can recover or validate it.

To understand the process clearly, consider encrypted messaging. First, the sender types a message in plain form. Then the messaging app uses encryption software and a cryptographic key to convert the message into unreadable ciphertext. The ciphertext is sent over the internet. When it reaches the receiver, the receiver’s device uses the correct key to decrypt it back into readable text.

A simple flow of the process is:

Plaintext → Encryption Algorithm + Key → Ciphertext → Decryption Algorithm + Key → Plaintext

For hashing, the process is slightly different:

Data → Hash Function → Fixed-Length Hash Value

This hash value is then used to verify whether the data remains unchanged.


Advantages / Applications

Protects sensitive information

  • Cryptography secures passwords, financial records, personal data, medical records, and confidential business documents from unauthorized access.

Supports secure communication and online transactions

  • It enables safe internet banking, e-commerce payments, secure messaging, virtual private networks, and HTTPS websites.

Provides trust and authenticity

  • Cryptography helps confirm the identity of users, devices, and websites, and it supports digital signatures, certificates, and secure authentication systems.

Cryptography is used in many real-life systems. For example, when you visit a secure website, HTTPS uses cryptographic protocols to protect communication between your browser and the server. In mobile applications, cryptography secures login credentials and session data. In blockchain systems, it helps verify transactions and protect data integrity. In cloud services, it protects stored files and communication between devices and servers.

Its advantages go beyond secrecy. It helps organizations meet legal and regulatory requirements, reduces the risk of data theft, and builds user confidence in digital services. Without cryptography, online commerce, secure messaging, and digital identity systems would be extremely vulnerable.


Summary

  • Cryptography is the method of protecting information by converting it into a secure form.
  • It uses algorithms and keys to provide confidentiality, integrity, and authentication.
  • It is widely used in secure communication, online transactions, and data protection.
  • Important terms to remember: plaintext, ciphertext, encryption, decryption, key, hash, digital signature, confidentiality.