BASIC CRYPTOGRAPHY
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. 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:
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. Integrity: Information cannot be modified in storage or transition between sender and
intended receiver without any addition to information being detected.
3. Non-repudiation: The creator/sender of information cannot deny his intention to send
information at a later stage.
4. Authentication: The identities of the sender and receiver are confirmed. As well
destination/origin of the information is confirmed.
5. Interoperability: Cryptography allows for secure communication between different
systems and platforms.
6. Adaptability: Cryptography continuously evolves to stay ahead of security threats and
technological advancements.
How Does a Cryptographic Key Work?
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" + ⚿ = "HYMeAS90#"
For example- " cryptography " is a plaintext and convert into ciphertext "HYMeAS90#" with
the help of cryptographic key.
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:
2. Hash Functions
There is no key required in hash function cryptography as it uses mathematical equations
to genrate a hash message for nay arbitrary length of message, and the output will be of
fixed length. Some of the famous hash function are:
• SHA-256
• MD5
• MD6
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.
What is Symmetric Encryption?
When the plain text is encrypted and decrypted using the same key, it is known as symmetric
encryption. It is also known as "shared-key" or "private-key" encryption. It ensures
confidentiality by ensuring only authorized parties with the key can access the original data.
The key is a piece of a shared secret between the two parties involved hence it is 'shared-key'
and is kept secret, hence the name 'private-key' is justified.
How does Symmetric Encryption Work?
From key generation to decryption, multiple steps are involved when symmetric encryption is
applied. These are the steps involved in sharing a message securely over the network using
the symmetric encryption technique.
1. Key Generation:
The first step involves selecting a private key. A secure key is generated using algorithms like
PBKDF2 (Password-Based Key Derivation Function 2) or hardware random number
generators. This key must be securely shared or transferred over the network for future use.
Example: A 256-bit AES key: 3A7F2B4E... (32-byte hexadecimal string).
2. Encryption:
In this step, the original message (plain text) is transformed into unreadable text (ciphertext)
,and the plaintext is processed in blocks or streams using an encryption algorithm and the
secret key.
Example: AES-256 in CBC (Cipher Block Chaining) mode encrypts a 128-bit block of
plaintext with the key and an initialization vector (IV) to produce ciphertext.
3. Transfer of Cipher text:
The encrypted message (ciphertext) is then sent over the network. Even if intercepted, it
remains unreadable to the attacker unless they have access to the shared secret key and the
algorithm used for encryption.
4. Decryption:
In the final step, the recipient uses the same secret key and a reverse encryption algorithm to
convert the cipher text back into the original message (plain text).
Advantages of Symmetric Encryption
Symmetric encryption has been proven to be a fast, simple and efficient method of securing
communication. Some of the key advantages of symmetric encryption include:
• Speed: Symmetric encryption algorithms are typically faster and less computationally
demanding than asymmetric encryption, making them ideal for encrypting large
volumes of data efficiently.
• Simplicity: With symmetric encryption, a single key is used for both encryption and
decryption, simplifying key management particularly in scenarios where key sharing
is not a significant concern.
• Bandwidth Efficiency: Encrypted data using symmetric algorithms tends to be
smaller in size, which helps reduce bandwidth usage when transmitting encrypted
information.
Public key encryption
Public key encryption (also known as asymmetric encryption) is a method of encrypting
data using a pair of cryptographic keys:
1. Public key – shared with everyone.
2. Private key – kept secret by the owner.
How It Works:
Encryption:
• Sender uses the recipient’s public key to encrypt a message.
• Only the recipient’s private key can decrypt that message.
Decryption:
• The recipient uses their private key to decrypt the message that was encrypted with
their public key.
Key Characteristics:
• Asymmetric: Different keys for encryption and decryption.
• Secure for communication: You don’t need to share the private key, reducing risk.
• Slower than symmetric encryption, so often used to encrypt small data or keys rather
than large files directly.
Use Cases:
• Secure emails (e.g., PGP/GPG)
• SSL/TLS (used in HTTPS to secure web traffic)
• Digital signatures (verifying identity and integrity)
• Cryptocurrencies (e.g., Bitcoin addresses use public keys)
Example:
1. Alice wants to send Bob a secure message.
2. Bob shares his public key with Alice.
3. Alice encrypts the message using Bob’s public key.
4. Bob uses his private key to decrypt the message.