[newbie] encyption/decryption and padding

Morten Bagai <[email protected]>
Newsgroups gmane.comp.python.cryptography
Message-ID <[email protected]>
Hi,

I'm new to pycrypto. I'm trying to do something really basic, which  
is to decrypt an ASCII-HEX block of ciphertext with Blowfish using a  
simple key. Here's how i do it:

from Crypto.Cipher import Blowfish
from binascii import hexlify,unhexlify

# some ascii-hex cipher text
ciphertext =  
'AE930CE7794D7EFE80D30D0EC79243F99DB7C3FC5D19048D86724EA945FD8E47'
# not a real key
key = 'blah'

mycipher = Blowfish.new(pwd,Blowfish.MODE_ECB)
cleartext =  mycipher.decrypt(unhexlify(ciphertext))

This works fine, except in addition to the original cleartext, i also  
get the padding as a result of the "decrypt" method call. Is this  
normal? If so, what's the standard way to get rid of the padding?  
Also, when encrypting with a symmetric algorithm like Blowfish, are  
there any convenience functions in the toolkit for applying padding,  
say PKCS#5, automatically?

Thanks,

Morten
PGP.sig (application/pgp-signature, 186 B) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.