Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #52665

Question about crypto

Date 2013-08-18 16:56 -0500
From Anthony Papillion <papillion@gmail.com>
Subject Question about crypto
Newsgroups comp.lang.python
Message-ID <mailman.6.1376863028.19984.python-list@python.org> (permalink)

Show all headers | View raw


I've just started working with the Crypto library and I've already run
into a wall even though I'm following a tutorial. Basically, I'm trying
to encrypt a string using AES in CBC mode. Here is the code:

from Crypto import AES
import hashlib

text_to_encrypt = 'This is a super secret encrypted message, yo!'
key = '0123456789abcdef'
mode = AES.MODE_CBC
encryptor = AES.new(key, mode)

ciphertext = encryptor.encrypt(text)

When I run the code above, I am told that the IV must be 16 bytes long.
I'm assuming that the IV (I know that means "Initialization Vector") is
either the key OR something else I can set. But I don't know how or what
to do.

Does anyone see what is wrong with the code above and could suggest ways
to make it work? I've spent the last 45 minutes googling around and
nothing comes up specific to my problem.

Thanks,
Anthony

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Question about crypto Anthony Papillion <papillion@gmail.com> - 2013-08-18 16:56 -0500
  Re: Question about crypto Roy Smith <roy@panix.com> - 2013-08-18 18:52 -0400
    Re: Question about crypto Anthony Papillion <papillion@gmail.com> - 2013-08-19 07:35 -0500

csiph-web