dimanche 12 février 2017

DES.MODE_OFB Encryption and DEcryption

Vote count: 0

I am very new to cryptography. I need to generate a sequence of bytes using OFB mode of DES block encryption function and carry out tests to check if the sequence of bits generated is cryptographically secure. Then do th procedure again by reducing number of rounds in block encryption by half.

from Crypto.Cipher import DES
from Crypto import Random
key = b'ThisIsKey'
iv = Random.new().read(DES.block_size)
cipher = DES.new(key, DES.MODE_OFB, iv[:DES.block_size]) #Is this the correct way?
plaintext = b'This is some text to encrypt'
msg = iv + cipher.encrypt(plaintext)

How to make the follwoing work?

msgback= cipher.decrypt(msg)

How to specify number of rounds here?

asked 36 secs ago

Let's block ads! (Why?)



DES.MODE_OFB Encryption and DEcryption

Aucun commentaire:

Enregistrer un commentaire