views:

62

answers:

3

I need to encrpyt a small string in Python. Is it possible to use a secret key to encrypt the string? Is there a good way to do this and achieve a reasonable encpryption level using only Python libraries? Could you show me how to do this?

My knowledge about cryptography is quite basic. : Thank you.

+1  A: 

Take a look at py-bcrypt. Perhaps it will meet your needs. From the web site:

py-bcrypt is a Python wrapper of OpenBSD's Blowfish password hashing code, as described in "A Future-Adaptable Password Scheme" by Niels Provos and David Mazières

Manoj Govindan
A: 

KeyCzar has a nice interface and should meet your requirements. From the home page:

Keyczar is an open source cryptographic toolkit designed to make it easier and safer for devlopers to use cryptography in their applications. Keyczar supports authentication and encryption with both symmetric and asymmetric keys

crypter = Crypter.Read("/path/to/your/keys")
ciphertext = crypter.Encrypt("Secret message")
ars
A: 

I solved this by using a lightweight XTEA library that i found on ASPN. It doesn't require any additional Python libraries and is quite simple to implement whilst acheiving a resonable encryption level.

Mridang Agarwalla