0% found this document useful (0 votes)
5 views5 pages

Css 1

The document outlines the design and implementation of a product cipher using substitution and transposition methods in cryptography. It details the encryption and decryption algorithms for both types of ciphers, emphasizing the importance of keys and the symmetric cipher model. The conclusion mentions the successful study of AI for medical prognosis using Logistic Regression.

Uploaded by

viveklevelup1
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views5 pages

Css 1

The document outlines the design and implementation of a product cipher using substitution and transposition methods in cryptography. It details the encryption and decryption algorithms for both types of ciphers, emphasizing the importance of keys and the symmetric cipher model. The conclusion mentions the successful study of AI for medical prognosis using Logistic Regression.

Uploaded by

viveklevelup1
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Department of Artificial Intelligence and Data Science

Experiment No. 1

Aim : Design and Implementation of a product cipher using Substitution and Transposition

Theory: Cryptography is an art of achieving security by encoding messages to make them


non-readable.

Product Cipher is a combination of both these types to achieve a better effect of security. An
original message is known as the plaintext, while the encoded message is called a cipher text.
The process of converting from plaintext to the cipher text is enciphering or encryption. The
many schemes used for encryption constitute the area of knowledge of the enciphering details
which falls into the area called cryptanalysis. Cryptanalysis is what the layperson calls
“breaking the code”. The areas of cryptography and cryptanalysis together are called
cryptology.

There are two types of cryptographic algorithms:


• Substitution
• Transposition

1. Substitution Cipher

A substitution cipher is a type of encryption where each character in the plaintext is replaced
by another character according to a defined rule or key.
• Common examples include Caesar cipher, where characters are shifted by a
certain number of positions, and monoalphabetic cipher, where each character maps uniquely
to another character.
• Substitution ciphers provide simplicity but are vulnerable to frequency analysis,
where the occurrence of characters in the ciphertext is compared to known frequencies of letters
in the original language.

Encryption Algorithm for Substitution Cipher

1. Take the plaintext.


2. Choose a key for substitution (e.g., shift value in a Caesar cipher).
3. For each character in the plaintext:
• Convert it to its corresponding encrypted character by adding the key
value.
• If using modulo arithmetic, apply mod 26 for alphabetical characters.
4. Store the result as the ciphertext.

Decryption Algorithm for Substitution Cipher

1. Take the ciphertext.


2. Use the same key used for encryption.
3. For each character in the ciphertext:
• Convert it to its original plaintext character by subtracting the key
value.
• If using modulo arithmetic, apply mod 26 for alphabetical characters.
4. Store the result as the plaintext.
Department of Artificial Intelligence and Data Science

2. Transposition Cipher

A transposition cipher rearranges the positions of characters in the plaintext without changing
the actual characters.
• Unlike substitution ciphers, transposition only changes the order of characters.
• Examples include rail fence cipher and columnar transposition.
• These ciphers are harder to break using frequency analysis but require complex
keys and strict order of rearrangement.

Encryption Algorithm for Transposition Cipher

1. Take the plaintext.


2. Choose a key to define the arrangement.
3. Arrange the plaintext characters in a matrix with rows equal to the key length.
4. Read the matrix column-wise to form the ciphertext.
5. Store the result as the ciphertext.

Decryption Algorithm for Transposition Cipher

1. Take the ciphertext.


2. Use the same key used for encryption.
3. Recreate the matrix using the key by filling it column-wise with the ciphertext.
4. Read the matrix row-wise to reconstruct the plaintext.
5. Store the result as the plaintext.

Symmetric Cipher Model

The symmetric cipher model is an encryption approach where the same secret key is used for
both encryption and decryption. This model is widely used in cryptographic systems due to its
efficiency.

Components of Symmetric Cipher Model


1. Plaintext-:
The original, readable message or data that needs to be encrypted.

2. Encryption Algorithm-:
A mathematical process that transforms plaintext into ciphertext using the
secret key.
Common algorithms include AES, DES, and 3DES.

3. Secret Key-:
A shared key known only to the sender and receiver.
The security of the symmetric cipher depends on keeping this key secret.

4. Ciphertext-:
The encrypted output produced by the encryption algorithm.
It appears as a random, unintelligible string of characters.
Department of Artificial Intelligence and Data Science

5. Decryption Algorithm-:
A process that takes the ciphertext and the secret key to reproduce the original
plaintext.

Conclusion: Hence, we have successfully studied AI for medical prognosis and implemented
it using Logistic Regression
Department of Artificial Intelligence and Data Science
Name : SHAAD KHANDWANI ROLLNO: 622

CODE AND OUTPUT FOR SUBSTITUTION:


Department of Artificial Intelligence and Data Science

CODE AND OUTPUT FOR TRANSPOSITION:

You might also like