3._ISDV_Exp[1]
3._ISDV_Exp[1]
Experiment No: 3
Implementation of Hill cipher
Date:
Relevant CO: Explore the basic principles of the symmetric cryptography and techniques with their
strengths and weaknesses from perspective of cryptanalysis
Algorithm:
STEP-1: Read the plain text and key from the user.
STEP-2: Split the plain text into groups of length three.
STEP-3: Arrange the keyword in a 3*3 matrix.
STEP-4: Multiply the two matrices to obtain the cipher text of length three.
STEP-5: Combine all these groups to get the complete cipher text.
Program:
# Generate a key
key = Fernet.generate_key()
cipher = Fernet(key)
# Encrypting a message
plaintext = b"Symmetric cryptography is secure."
ciphertext = cipher.encrypt(plaintext)
# Display results
print(f"Original: {plaintext.decode()}")
print(f"Encrypted: {ciphertext}")
print(f"Decrypted: {decrypted_text.decode()}")
3170720 INFORMATION SECURITY 210210107017
Output:
Conclusion:
- Symmetric cryptography is essential for modern data security, utilizing a single
key for both encryption and decryption, which enhances efficiency and speed.
Techniques such as AES provide strong security, but key management remains a
critical challenge, as the compromise of the key can jeopardize all associated data.
While symmetric algorithms are faster and simpler to implement than asymmetric
methods, they are not without vulnerabilities, including susceptibility to
cryptanalysis techniques like frequency analysis. Understanding these principles
and employing robust algorithms ensures effective protection of sensitive
information in a secure digital landscape.
Quiz:
-To understand and implement the Hill cipher, one must grasp several key concepts. First, a basic
knowledge of linear algebra is essential, particularly in understanding matrices, matrix
multiplication, determinants, and matrix inverses, as these are fundamental to the cipher's operations.
Next, familiarity with modular arithmetic is crucial, especially the modulo operation (commonly
modulo 26 for alphabetic text) and the ability to find multiplicative inverses. Additionally, a solid
understanding of basic cryptographic concepts, including the principles of encryption and
decryption, as well as symmetric key cryptography, provides necessary context for the cipher's
functionality. Lastly, knowing how to map letters to numerical values (e.g., A=0, B=1, ..., Z=25) is
important for implementing the algorithm effectively. Together, these concepts create a strong
foundation for working with the Hill cipher in cryptography.
Key Characteristics:
Substitution Cipher: In a substitution cipher, each letter in the plaintext is replaced with
another letter or symbol based on a fixed system.
Polygraphic: The Hill cipher encrypts blocks of letters (typically pairs or triplets) rather than
individual letters, making it polygraphic. This means it substitutes multiple characters at once
using matrix operations.
3170720 INFORMATION SECURITY 210210107017
Additional Context:
The Hill cipher uses linear algebra concepts, specifically matrix multiplication, to perform
the substitutions, which adds complexity and security compared to simpler substitution
ciphers that handle one character at a time.
Suggested Reference:
1. https://crypto.interactive-maths.com/hill-cipher.html
Rubrics 1 2 3 4 5 Total
Marks