Graduate → Discrete Mathematics ↓
Cryptography
Cryptography is an important field of study within discrete mathematics and plays a vital role in ensuring security on a variety of platforms today. At its core, cryptography is the practice of secure communications in the presence of adversaries. It has a long history, dating back thousands of years, but in contemporary settings, it is a fundamental part of computer science and information security.
Understanding cryptography
Cryptography involves creating methods to protect communications. It is used to protect information from unauthorized access, ensure data integrity, provide authentication, and even ensure that data cannot be denied once it has been created. The main concepts revolve around encryption and decryption:
Encryption and decryption
Encryption is a process in which plain text information is converted into an unreadable form called cipher text using an algorithm and a key. The key is a vital part of the encryption process, which determines how the text is transformed.
Decryption is the reverse process, where the cipher text is converted back into readable plain text. This process requires knowledge of the key used in encryption.
Example of basic encryption: Caesar cipher
A simple example of an encryption method is the Caesar cipher. This cipher is named after Julius Caesar, who, according to legend, used it to communicate with his generals.
In a Caesar cipher, each letter in the plain text is 'shifted' a certain number down in the alphabet. Here's how it works:
Plain Text : HELLO Shift : 3 Encrypted : KHOOR
How does it work? Consider the alphabet:
ABCDEFGHIJKLMNOPQRSTUVWXYZ
If we move three places to the right:
DEFGHIJKLMNOPQRSTUVWXYZABC
Thus, 'H' becomes 'K', 'E' becomes 'H', 'L' becomes 'O', and so on.
Types of cryptography
Cryptographic methods may be broadly classified into three types:
1. Symmetric key cryptography
In symmetric key cryptography, the same key is used for both encryption and decryption. This is similar to a locked box that both parties can open because they have the same key. It is efficient and fast, but the challenge lies in sharing the key securely. Some common symmetric algorithms include:
- Data Encryption Standard (DES)
- Advanced Encryption Standard (AES)
Visual example:
2. Asymmetric key cryptography
Asymmetric algorithms use a pair of keys - a public key and a private key. The public key is shared openly and used for encryption, while the private key is kept secret for decryption. It has significant advantages over symmetric cryptography in terms of key distribution but is more computationally intensive.
- Rivest–Shamir–Adleman (RSA)
- Elliptic Curve Cryptography (ECC)
Visual example:
3. Hash functions
Hash functions do not involve keys. Instead, they take an input (or 'message') and return a fixed-size string of bytes. The output, usually a 'digest', is unique for each unique input. It is nearly impossible to derive the original input from its hash output.
Hash functions are used to ensure data integrity and password storage, among other applications. Popular hash functions include:
- MD5 (now considered insecure for many applications)
- SHA-256
Visual example:
Mathematical foundations of cryptography
Mathematics is the basis of cryptography, with number theory and algebra playing important roles. Some of the important concepts are as follows:
1. Modular arithmetic
Cryptographic algorithms often use modular arithmetic. This is like clockwork arithmetic where the numbers rotate after reaching a certain point - the 'modulus'. For example, in modulo 12 arithmetic, 13 equals 1:
13 mod 12 = 1
Modular arithmetic is essential in many cryptographic systems, notably RSA, which uses properties of prime numbers in its operations.
2. Prime numbers
Prime numbers, numbers that are divisible only by 1 and themselves, are fundamental in cryptography. They are used to generate keys in algorithms such as RSA. The difficulty of factoring large numbers into primes underlies the security of these systems.
3. Euler's totient function
Euler's totient function, denoted φ(n)
, is important in cryptography for computing public and private keys. It counts the number of integers up to a given integer n
that are coprime with n
.
4. Discrete logarithm
The discrete logarithm problem is another mathematical concept used in cryptography. It is similar to the regular logarithm, but within the set of integers. This problem underlies the security of some cryptographic systems such as Diffie-Hellman key exchange.
Applications of cryptography
Cryptography plays a vital role in securing information systems. Its major applications include:
1. Secure communication
Encryption allows private conversations over public channels. Classic uses include secure web browsing (HTTPS), which relies on cryptographic protocols to protect data transmitted over the Internet.
2. Authentication
Cryptography ensures that data comes from a verified source. Techniques such as digital signatures allow users to verify the authenticity of a message, software, or digital document.
3. Digital signature
These are the cryptographic equivalent of handwritten signatures, but they are much more secure. Digital signatures certify the integrity and origin of the message, ensuring it has not been altered.
4. Cryptographic hash functions in password security
Hash functions store passwords securely. When a user inputs a password, it is hashed and compared to the stored hash. This means that even if the hash database is tampered with, the passwords are not directly exposed.
Conclusion
Cryptography is a cornerstone of modern security practices, enabling secure transactions and communications across digital platforms. Its foundations in discrete mathematics, particularly in number theory and algebra, highlight the complex relationships between mathematical theory and practical applications. By protecting information, cryptography remains an essential field in maintaining privacy and trust in an increasingly connected world.