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


Groups > comp.lang.python > #52665

Question about crypto

Path csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <papillion@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.045
X-Spam-Evidence '*H*': 0.91; '*S*': 0.00; 'subject:Question': 0.07; 'string': 0.09; 'assuming': 0.09; 'suggest': 0.14; 'googling': 0.16; 'hashlib': 0.16; 'thanks,': 0.17; 'do.': 0.18; 'library': 0.18; 'trying': 0.19; 'import': 0.22; 'header:User-Agent:1': 0.23; 'bytes': 0.24; "i've": 0.25; 'code:': 0.26; 'mode': 0.30; "i'm": 0.30; 'code': 0.31; "skip:' 10": 0.31; 'long.': 0.31; 'anyone': 0.31; 'run': 0.32; 'could': 0.34; 'problem.': 0.35; 'something': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'set.': 0.36; 'wrong': 0.37; 'message-id:@gmail.com': 0.38; 'work?': 0.38; 'to:addr:python-list': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'either': 0.39; 'how': 0.40; 'even': 0.60; 'above,': 0.60; 'wall': 0.65; 'here': 0.66; 'minutes': 0.67; 'secret': 0.74; 'encrypted': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=EaIKvkjAtWcg1fjNygpGpHtlTAk+5Zxodsky6ajRg/Y=; b=eq2EPKmpKQOEUm8z6EQWLjOLeXNnB2kgkiVMw0oL7+AokPxlQD8/S8iPKUVYH0hx9w WxOMMVKGJYNK+TGmIE040z+PkvxC9W7MoSQWxaQ9cKt3R40D391Ea7o4bULA/JAKnQxq Q2qj/29qQ413Klo6IFyf65rCjqXSg7vu800lEG/4l46p2cl6X8giheD7y+4QqQTtHXhx equxX0JFzjrquMl1NdX8QRkXe7ziAq49Jtxco2d56Kqj4EM5Vm++BGHGFHHbUVuGNkzH brd4I1BLqdW6Q/r9jazbFnaDFklqlE4sai0WH2zSGs5m1dOQjRgYjMh0gX3WwgXN5l0c 69pA==
X-Received by 10.50.13.104 with SMTP id g8mr307952igc.30.1376863020502; Sun, 18 Aug 2013 14:57:00 -0700 (PDT)
Date Sun, 18 Aug 2013 16:56:57 -0500
From Anthony Papillion <papillion@gmail.com>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130804 Thunderbird/17.0.8
MIME-Version 1.0
To python-list@python.org
Subject Question about crypto
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 7bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.6.1376863028.19984.python-list@python.org> (permalink)
Lines 25
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1376863028 news.xs4all.nl 15957 [2001:888:2000:d::a6]:35883
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:52665

Show key headers only | 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