0% found this document useful (0 votes)
11 views

ICS-Assignment 1 Code & Output

The document provides code for encrypting text using DES encryption with a password key and padding, and base32 encoding the encrypted output.

Uploaded by

Mansi Dhake
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)
11 views

ICS-Assignment 1 Code & Output

The document provides code for encrypting text using DES encryption with a password key and padding, and base32 encoding the encrypted output.

Uploaded by

Mansi Dhake
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
You are on page 1/ 2

Nikita Marne

24276

72004863L

ICS

ASSIGNMENT 1 CODE:
from Crypto.Cipher import DES import
base32hex
def
pad(text):
n = len(text) % 8
return text + (' ' * n)

key = 'Password' plaintext = 'Python is the


Best Language!'
des = DES.new(key,
DES.MODE_ECB)
padded_text = pad(plaintext) encrypted_text =
des.encrypt(padded_text) cipher_text =
base32hex.b32encode(encrypted_text)

print("Encrypt:",cipher_text)
print("Decrypt:",des.decrypt(encrypted_text))

OUTPUT:

You might also like