Is CH2
Is CH2
Is CH2
Cryptographic Algorithms
Main Points:
Stream ciphers: Feistal Cipher
Block Cipher: AES, DES
IDEA, Block Cipher Modes
Asymmetric Key Cryptography: Deffie-Hellman
Elgamal Cryptosystem
Elliptical Curve Cryptography
Block Ciphers
Mechanism
Fixed Block Size: Block ciphers operate on fixed-size blocks of
data, typically 64 or 128 bits. If the input data is not a multiple of the
block size, padding schemes (like PKCS#7) are used to extend the
data to fit the required size.
Rounds: Block ciphers typically use multiple rounds of encryption,
where each round consists of several operations, including
substitution (replacing bits with others), permutation (rearranging
bits), and key mixing (combining the data with the round key).
Modes of Operation: Block ciphers can operate in various modes,
allowing them to process data securely and efficiently. Some
common modes include:
o ECB (Electronic Codebook): The Electronic Code Book (ECB)
in Cryptography is the most basic and weakest version of DES.
At the sender site, plain text messages are split into 64-bit sub-
blocks. This technique encrypts each subblock individually. Two
plaintexts with partially similar sections (such as a letter
header) encrypted with the same key are partially identical
ciphertext portions. ECB is appropriate for encrypting small
messages, but CBC is better suited to encrypting larger ones.
How Does ECB Mode in Cryptography Work?
The Electronic Code Book (ECB) mode is one of the easiest
and most effective algorithms to use as a simple
replacement technique.
The input plaintext is divided into blocks and encrypted
separately with the key. This enables the decryption of
each encrypted block independently. Encrypting the same
block twice returns the same ciphertext twice.
In general, if a message is greater than b bits, it can be
divided into blocks and the process repeated.
Stream Ciphers
Mechanism
Bit-by-Bit Processing: Stream ciphers encrypt data one bit (or
byte) at a time. They typically generate a keystream that is XORed
with the plaintext to produce ciphertext.
Key Stream Generation: The keystream is generated based on the
encryption key and can be derived from various algorithms (e.g.,
linear feedback shift registers (LFSRs), cryptographic functions).
Simplicity: The operations in stream ciphers are usually simpler
than those in block ciphers, focusing on XOR operations and basic
arithmetic.
Applications
Real-Time Communication: Ideal for scenarios requiring low
latency, such as voice over IP (VoIP) and video streaming.
Secure Network Protocols: Used in protocols like WEP (Wired
Equivalent Privacy) and WPA (Wi-Fi Protected Access) for securing
wireless communications.
Embedded Systems: Often found in resource-constrained
environments where processing power and memory are limited.
Examples
RC4: A widely used stream cipher known for its simplicity and speed
but has known vulnerabilities.
A5/1: A stream cipher used in GSM mobile communications, which
has also been found vulnerable to attacks.
ChaCha20: A modern stream cipher known for its performance and
security, often used in secure communication protocols like TLS.
Key Differences Recap
1. Data Size:
o Block Ciphers: Encrypt fixed-size blocks (e.g., 128 bits).
o Stream Ciphers: Encrypt continuous streams of data,
processing bit-by-bit or byte-by-byte.
2. Processing Mode:
o Block Ciphers: Requires padding and can work in different
modes to enhance security.
o Stream Ciphers: Processes data as it arrives without needing
padding.
3. Error Propagation:
o Block Ciphers: Errors typically affect only the block where the
error occurred.
o Stream Ciphers: Errors in the stream can affect subsequent
data, potentially altering the entire stream.
4. Performance:
o Block Ciphers: Slower for small messages due to the need to
wait for full block processing.
o Stream Ciphers: Generally faster and more efficient for large
amounts of data or real-time applications.
5. Security Considerations:
o Block Ciphers: Must be used in secure modes to avoid
vulnerabilities like chosen plaintext attacks.
o Stream Ciphers: Vulnerable to key reuse and must ensure
that the keystream is unique for each session.
Feature Block Cipher Stream Cipher
Definition Encrypts data in fixed-size Encrypts data one bit or byte
blocks (e.g., 64 bits, 128 at a time, typically using a
bits). key stream.
Data Processes entire blocks of Processes plaintext as a
Processing plaintext at once, producing continuous stream,
ciphertext blocks of the generating ciphertext in
same size. real-time.
Example AES, DES, IDEA, Blowfish RC4, A5/1, Salsa20,
Algorithms ChaCha20
Mode of Can be used in various Typically does not require
Operation modes (e.g., ECB, CBC, modes, but some variations
CFB, OFB, CTR) to enhance exist (e.g., CFB and OFB can
security and functionality. be seen as stream modes).
Performan Generally slower for small Generally faster for
ce amounts of data due to the processing large amounts of
need to wait for a full block data or real-time data
to process. streams.
Error Errors affect only the block Errors in one byte may affect
Propagati where the error occurred
all subsequent bytes in the
on (unless in certain modes).
stream due to the
continuous nature.
Security Security depends on block Vulnerable to attacks if the
Concerns size and mode of operation; same key stream is used
longer blocks tend to be with different plaintext (key
more secure against certain reuse); proper key
attacks. management is crucial.
Key Often requires fewer key Requires careful key stream
Manageme management operations for management to ensure
nt long messages, as a single security, especially in long
key can encrypt many sessions.
blocks.
Feistal Cipher
Feistel Cipher model is a structure or a design used to develop many
block ciphers such as DES. Feistel cipher may have invertible, non-
invertible and self invertible components in its design. Same encryption
as well as decryption algorithm is used. A separate key is used for each
round. However same round keys are used for encryption as well as
decryption.
Feistel cipher algorithm
Create a list of all the Plain Text characters.
Convert the Plain Text to Ascii and then 8-bit binary format.
Divide the binary Plain Text string into two halves: left half (L1)and
right half (R1)
Generate a random binary keys (K1 and K2) of length equal to the
half the length of the Plain Text for the two rounds.
First Round of Encryption
a. Generate function f1 using R1 and K1 as follows:
f1= xor(R1, K1)
b. Now the new left half(L2) and right half(R2) after round 1 are as
follows:
R2= xor(f1, L1)
L2=R1
Second Round of Encryption
a. Generate function f2 using R2 and K2 as follows:
Ciphertext=Plaintext ⊕
o XOR Operation: The keystream is XORed with the plaintext to
produce ciphertext:
Keystream
4. Security Properties
Confidentiality: A5/1 is designed to provide a secure method for
protecting the contents of GSM calls.
Key Length: The 64-bit key length was considered secure at the
time of its design. However, it is now deemed weak against modern
computational power.
5. Vulnerabilities
Brute Force Attacks: The 64-bit key length makes A5/1 vulnerable
to brute-force attacks. In 2009, researchers demonstrated that it was
possible to break A5/1 in real-time using dedicated hardware.
Weaknesses in LFSR: The design of A5/1, relying solely on LFSRs,
is susceptible to various cryptanalytic attacks, including:
o Known-Plaintext Attacks: If an attacker knows a portion of
the plaintext, they can recover the keystream and thus the
encryption key.
o Statistical Attacks: Patterns in the keystream can be
exploited to break the cipher.
Legacy Concerns: As technology has advanced, A5/1 has been
considered insecure, leading to the adoption of stronger algorithms
in newer mobile communications standards.
6. Current Status and Alternatives
Replacement: Due to its vulnerabilities, A5/1 has been largely
replaced by more secure algorithms like A5/3 (which uses the
Kasumi block cipher) in modern mobile networks.
GSM Security: While A5/1 was a step forward in mobile
communication security during its inception, the industry has moved
towards stronger encryption methods to ensure confidentiality in
voice and data transmissions.
Advanced Encrypted Standard (AES)
Advanced Encryption Standard (AES) is a highly trusted encryption
algorithm used to secure data by converting it into an unreadable
format without the proper key. Developed by the National Institute of
Standards and Technology (NIST), AES encryption uses various key
lengths (128, 192, or 256 bits) to provide strong protection against
unauthorized access. This data security measure is efficient and widely
implemented in securing internet communication,
protecting sensitive data, and encrypting files. AES, a cornerstone of
modern cryptography, is recognized globally for its ability to keep
information safe from cyber threats.
Points to Remember
AES is a Block Cipher.
The key size can be 128/192/256 bits.
Encrypts data in blocks of 128 bits each.
That means it takes 128 bits as input and outputs 128 bits of encrypted
cipher text. AES relies on the substitution-permutation network principle,
which is performed using a series of linked operations that involve
replacing and shuffling the input data.
Working of The Cipher
AES performs operations on bytes of data rather than in bits. Since the
block size is 128 bits, the cipher processes 128 bits (or 16 bytes) of the
input data at a time.
The number of rounds depends on the key length as follows :
128-bit key – 10 rounds
192-bit key – 12 rounds
256-bit key – 14 rounds
Creation of Round Keys
A Key Schedule algorithm calculates all the round keys from the key. So
the initial key is used to create many different round keys which will be
used in the corresponding round of the encryption.
Mix Columns
This step is a matrix multiplication. Each column is multiplied with a
specific matrix and thus the position of each byte in the column is
changed as a result.
This step is skipped in the last round.
Inverse SubBytes
Inverse S-box is used as a lookup table and using which the bytes are
substituted during decryption.
Function Substitute performs a byte substitution on each byte of the input
word. For this purpose, it uses an S-box.