Untitled Document
Untitled Document
Saif Madre
Department of Computer Engineering
M.H Saboo Siddik College of
Engineering
Mumbai, India
[email protected]
Abstract
Encryption is the process of converting plaintext into ciphertext to protect information from
unauthorized access, ensuring confidentiality, integrity, and authenticity. By using mathematical
algorithms and cryptographic keys, encryption secures sensitive data during storage and transmission.
Symmetric encryption, such as AES, uses a single key for both encryption and decryption, while
asymmetric encryption, like RSA, employs a public-private key pair. Modern encryption is a
cornerstone of cybersecurity, enabling secure communication, protecting personal and financial
information, and safeguarding critical systems. Despite its robustness, the evolving landscape of
cryptographic attacks and computational advancements, such as quantum computing, presents
ongoing challenges, driving research into post-quantum encryption methods. Encryption remains a
critical tool for maintaining privacy and security in the digital age.
I. INTRODUCTION
Introduction
A product cipher is a cryptographic method combining two or more transformations to encrypt the
data. It's designed to deliver a higher level of security compared to ciphers that use only one
transformation technique. Transformations can be substitutional (like changing characters or bits) and
permutational (like rearranging the order).
To turn data from plaintext into ciphertext, product ciphers carry out multiple rounds of substitutions
and permutations, each round using a different subkey derived from the main key. It results in
securely encrypted data that’s very difficult to unencrypt without the proper key.
Affine Cipher is the development of Classic Caesar cipher that multiplies plain text before shifting
operation. Affine cipher has two parameters namely key a, and b. Key ‘a’ is multiplies the plain text.
It must have an inverse with Great Common Divisor (GCD) from the number of characters. The
Problems of Affine Cipher Algorithm is the number of characters available and the least possible of
key ‘a’ that can be used, so it is considered to be a classic technique that is easy to hack. Generally,
Affine Cipher is used to encrypt the plaintext of character ‘A to Z’ so that the number of keys ‘a’ is
only 12 digits from 26 digits (n) is available.
Encryption
It uses modular arithmetic to transform the integer that each plaintext letter corresponds to into
another integer that correspond to a ciphertext letter. The encryption function for a single letter is
E ( x ) = ( a x + b ) mod m
modulus m: size of the alphabet
a and b: key of the cipher.
a must be chosen such that a and m are coprime.
Decryption
In deciphering the ciphertext, we must perform the opposite (or inverse) functions on the ciphertext to
retrieve the plaintext. Once again, the first step is to convert each of the ciphertext letters into their
integer values. The decryption function is
D ( x ) = a^-1 ( x - b ) mod m
a^-1 : modular multiplicative inverse of a modulo m. i.e., it satisfies the equation
1 = a a^-1 mod m .
import random
class AffineCipher:
def _init_(self):
self.current_a = None
self.current_b = None
def generate_keys(self):
x = ord(char) - ord('a')
encrypted_pos = (a * x + b) % 26
return chr(encrypted_pos + ord('a'))
return char
y = ord(char) - ord('a')
for x in range(26):
if (a * x + b) % 26 == y:
return char
try:
if mode == 'encrypt':
self.generate_keys()
return False
content = file.read().lower()
if mode == 'encrypt':
else:
processed_content = ''.join(self.decrypt_char(c, self.current_a, self.current_b) for c in
content)
file.write(processed_content)
return True
except Exception as e:
return False
def main():
cipher = AffineCipher()
while True:
print("4. Exit")
if choice == '4':
print("Exiting program...")
break
if choice == '3':
if cipher.current_a is None:
else:
continue
if choice not in ['1', '2']:
continue
cipher.process_file(filename, mode)
if _name_ == "_main_":
main()
Output:
IV. CONCLUSION
IV. REFERENCES
[1] Product cipher definition
https://nordvpn.com/cybersecurity/glossary/product-cipher
[2] Modification Affine Cipher Transform Digraph to Squared the value of ‘n’ in Text Security
https://ieeexplore.ieee.org/document/9230503