Understanding Cryptography Types: Symmetric, Asymmetric, Hash and More…
Cryptography is a technique to secure information and communication by using a set of rule-based calculations called algorithms and some mathematical concepts so only the right person can understand it.
It is useful to prevent unauthorized access to information.
The word “cryptography” is derived from the Greek word kryptos, which means hidden. The word “crypto” means “hidden” and “graphy” means “writing”.
In this article, I will cover the basics of cryptography principles, explore various types with examples, discuss challenges, and look ahead to future trends. I aim to provide a comprehensive overview, covering both major and minor concepts.
Cryptography secures digital communication and information in various systems and applications, ensuring confidentiality and data security. It protects data from unauthorized access.
Let’s see what happens in cryptography:
- The process starts with the sender who has a message or data to send.
- The plaintext (original message) is then converted into an unreadable format using a method called encryption.
- The receiver uses a key to convert the ciphertext (unreadable format) back into a readable format, a process known as decryption.
- The decrypted message is again in plaintext and is the same as the original message sent by the sender.
- The receiver now has the original message.
Now, let’s explore the fundamental principles of cryptography.
Basic Principles of Cryptography
There are four main principles of cryptography:
#1. Confidentiality: Only the intended recipient can access the information; it remains private to others.
#2. Integrity: Information cannot be altered during storage or transmission without detection of any changes.
#3. Non-repudiation: The sender cannot deny sending the information later on.
#4. Authentication: It confirms the identities of both sender and receiver and verifies the source and destination of the information.
Before we continue, let’s go over some basic vocabulary.
Glossary:
Let’s understand the process through the following steps:
- The algorithm converts original text (plaintext) to ciphertext by using a secret key.
- Then, the sender sends that ciphertext to the recipient through the communication channel. This communication channel be private or public.
- Recipients use the same secret key to decrypt that ciphertext and convert it into original text.
This symmetric encryption process makes sure that the communication between sender and receiver remains secure. But, the secret key needs to be confidential.
To maintain confidentiality and integrity, both parties must securely manage and protect this secret key.
There are two types of symmetric encryption ciphers:
- Stream Cipher
- Block Cipher
- There are two keys. A public key, which everyone can access, and a private key, which is kept secret.
- The public key is used to encrypt or lock the data.
- The private key is used to decrypt or unlock the data.
It’s important to understand that you can’t figure out the private key from the public key. Also, public keys are usually linked to identities by organizations known as Certificate Authorities.
Secure Communication Sender and Receiver have exchanged a secure message without compromising their private keys.
These algorithms rely on mathematical problems like integer factorization and discrete logarithms to create digital signatures and establish/distribute session keys, such as in the TLS protocol.
Some examples of asymmetric encryption algorithms include:
- RSA (Rivest-Shamir-Adleman): RSA is one of the most widely used asymmetric encryption algorithms. It’s based on the mathematical properties of large prime numbers and is commonly used for secure key exchange and digital signatures.
- Elliptic Curve Cryptography (ECC): It is based on the algebraic structure of elliptic curves over finite fields. ECC offers the advantage of smaller key sizes compared to non-EC cryptography that relies on plain Galois fields. ECC is mainly used to generate pseudo-random numbers and digital signatures.
- Diffie-Hellman Key Exchange: This algorithm is used for secure key exchange. A key created using this method can be used for encryption with a symmetric algorithm. Diffie-Hellman’s main aim is to enable two parties to create a shared secret key over an insecure communication channel.
Advantages of Asymmetric Cryptography
- Asymmetric encryption provides stronger security compared to symmetric cryptography.
- The receiver can verify the sender’s identity.
- Asymmetric encryption solved the problem related to key distribution, which I mentioned in the disadvantages of symmetric key cryptography.
- Message recipients can detect if the message was altered in transit.
Disadvantages of Asymmetric Key Cryptography
- Asymmetric encryption is a slower process than symmetric cryptography.
- Asymmetric encryption and decryption require more computational resources than symmetric cryptography.
- Asymmetric cryptography relies on public and private keys. Managing these keys securely can be complex and challenging, especially in large-scale systems.
- The most significant potential disadvantage of asymmetric cryptography is its vulnerability to quantum computers. Quantum computers have the potential to solve certain mathematical problems, like integer factorization and discrete logarithms, much more efficiently than classical computers.
But, no need to worry organizations and researchers are working to transition to these quantum-resistant cryptographic techniques.
Let’s move toward our next type of cryptography:
Hash Function
Cryptographic hash functions are different from other types of cryptography. They don’t encrypt data. Instead, they use complex math to turn any data into a unique code made up of letters and numbers.
These codes are called hash codes, hash values, or message digests. They’re important for checking if data is safe; when data is sent or stored, its hash code is calculated and sent or kept with the data.
The recipient can recalculate the code of the data they received and check it against the one sent. If the codes match, it means the data stayed safe during transmission and storage.
Here’s a simple step-by-step explanation:
Sender’s Side:
- The sender uses a hash function to create a unique hash value for the provided data.
- After creating hash values, the sender sends both the original message and the hash code to the receiver through an insecure channel.
Receiver’s Side:
- The receiver receives the message and the hash code.
- The receiver also uses the same special tool (hash function) to create a new hash code for the received message.
- The receiver compares the new hash code with the one sent by the sender.
Outcome:
- If hash codes match, it means the message wasn’t altered during transmission, and it’s considered secure.
- If the hash codes don’t match, it suggests that the message might have been changed, and it’s not considered secure.
Here are some of the properties that make hash functions useful:
Properties of Hash Function:
- Deterministic: If you give the same input, It will always produce the same output.
- Uniformity and Collision Free: A good hash function should produce uniformly distributed outputs. It helps to avoid collisions.
- Efficient: Hash functions are designed to be computationally efficient, allowing them to quickly process large amounts of data.
- Fixed-Size Output: It produces a fixed-size output regardless of the input size. This property is essential because it enables efficient storage and retrieval of data.
Hash functions have many applications in computer science and information security, including cryptography, data integrity checking, data indexing, data fingerprinting, password storage, digital forensics, and blockchain.
Commonly used cryptographic hash functions include:
There are two widely used families of cryptographic hash functions –the MD family (MD = message digest) and the SHA family (SHA = secure hash algorithm).
- SHA-1 (Secure Hash Algorithm 1): It was one of the popular hash functions. However, SHA-1 is now considered weak due to vulnerabilities that allow for practical collision attacks. It is no longer used for most security applications.
- MD5 (Message Digest Algorithm 5): MD5 was popular in the past but is now considered weak due to collision vulnerabilities. It is generally not used for security-sensitive applications.
- SHA-3: SHA-3 is a newer family of hash functions selected through a competition by the National Institute of Standards and Technology (NIST). It provides strong security and is designed to be resistant to certain types of attacks.
Even though hash functions do not encrypt messages, they are an integral part of cryptography because they play a crucial role in securing and authenticating data, which are key goals in cryptography.
Advantages of Hash Function
- A secure hash function guarantees high collision resistance.
- Two files can be compared for equality easily through hashing.
- Hash functions are incredibly fast and efficient.
- In DBMS, hashing is used to search the location of the data without using an index structure.
Disadvantages of Hash Function
- Hash functions may work less effectively when there are numerous collisions.
- No null values are allowed.
- Implementing hash tables can be a challenging task due to their complexity.
- In practice, it is nearly impossible to entirely prevent hash collisions when dealing with a large set of potential keys.
Real-life Applications of Cryptography
- Authentication/Digital Signatures: Authentication is the vital process of confirming the authenticity of data, verifying the source of a document, validating sender identity, timestamp accuracy, and ensuring the legitimacy of computer or user identities. Digital signatures employ cryptographic methods that involve a hash function and a private key to validate and securely sign documents.
- Cloud Storage Encryption: Cryptography is employed to secure files stored in the cloud and during transmission to and from cloud services.
- Electronic Money: Electronic money involves electronic fund transfers between parties, which can be debit or credit, and either anonymous or identified. It uses encryption, digital signatures, and public-key cryptography for security, enabling various transaction types.
- Encryption/Decryption in Email: Email encryption secures email content from unauthorized access using public key cryptography. Each user has a public and private key pair, with the public key used for encryption, and only the private key can decrypt the message.
- Encryption in WhatsApp: WhatsApp uses the signal protocol for encryption, combining symmetric and asymmetric key cryptography for confidentiality, integrity, authentication, and non-repudiation. Curve25519-based algorithms are used for key exchange.
- Encryption in Instagram: Instagram communication is encrypted using SSL/TLS over port 443, preventing eavesdropping on data exchanged between the user and Instagram servers.
- SIM Card Authentication: SIM card authentication involves verifying the SIM card’s access to the network by generating a random number and applying algorithms like A3 with the secret key Ki. Encryption relies on the A8 algorithm and session key KC, used with the A5 algorithm for data encryption/decryption.
Challenges in Cryptography
- Key management remains a challenge, as securely distributing and managing encryption keys is complex, especially in large-scale systems. Key storage and recovery mechanisms need to be robust.
- Symmetric cryptography can become inefficient when many users need to communicate securely. Each pair of users requires a unique key, which can become unwieldy as the number of users increases.
- Asymmetric cryptography typically requires longer keys than symmetric cryptography to achieve the same level of security. This can lead to slower processing and increased resource requirements.
- The discovery of vulnerabilities or weaknesses in hash functions can lead to security breaches. The cryptographic community must continuously analyze and adapt hash functions to mitigate such risks.
- In applications where hash functions are used for password storage, proper salting of passwords is necessary to prevent rainbow table attacks. The challenge lies in ensuring that salts are unique and secret.
- The emergence of quantum computing poses a significant challenge to the world of cryptography. Quantum computers are exceptionally swift at solving specific mathematical problems, leveraging the peculiar principles of quantum physics for their extraordinary computational prowess.
This speed threatens the foundation of our current cryptographic systems, which rely on the complexity of certain mathematical challenges to ensure data security. Quantum computers have the capability to crack these problems much faster than conventional computers, potentially compromising the safety of our encryption methods.
The underlying principles of quantum mechanics that quantum computers utilize are indeed unusual but grant them the power to perform tasks that are beyond the reach of classical computers.
Consequently, the need to develop novel cryptographic techniques that can withstand quantum attacks is becoming increasingly pressing, creating an ongoing challenge within the field of cryptography.
Future Trends in Cryptography
- Developing and adopting post-quantum cryptography algorithms that are resistant to quantum attacks will be a significant trend. Algorithms like lattice-based cryptography are being explored.
- There is a growing acceptance of cloud-based encryption and key management, especially in finance. Homomorphic encryption allows computations on encrypted data without decrypting it. This can enhance privacy in cloud computing and data processing.
- Cryptography plays a crucial role in securing blockchain technology, and the two will continue to be intertwined in the future.
- With increased data protection regulations, such as GDPR, tokenization is being used more frequently in healthcare, financial services, and enterprises. Tokenization replaces actual data with a token that is worthless to hackers.
Final Words
Cryptography is a vast field with much to explore, and we have only scratched the surface by covering the basics of cryptography.
We’ve covered cryptography, its principles, cryptography types, hash functions, challenges, future trends, and practical applications.
Yet, there’s much more to discover.