

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer

I've recently been looking for a good (enough) method to encrypt files, and I came across this thing. It says that it's a

Simple p3 encryption "algorithm": it's just SHA used as a stream cipher in output feedback mode.

Honestly I don't know what much of that means, other than I know SHA is a hash function. The first thing I know about encryption is that creating a good algorithm is hard. Which is why I'm not doing something silly like rolling my own simple XOR encryption.

If I use a 10-20 character passphrase with this program, how secure would my files be?

share|improve this question
up vote 4 down vote accepted

Making your own crypto algorithm is considered a bad idea unless you are a cryptographer and are willing to spend a lot of time creating/testing it.

The algorithm in P3 is (according to the mailinglists) created by a guy who knows his stuff, but it's not a standard. I suggest using AES instead if you want to use passwords (AES is a symmetric encryption algorithm).

The problem at the moment is that there are no readily available modules for Python 3 that come with AES support. For Python 2.x there is Pycrypto, an excellent library for any cryptographic algorithm, but it's still getting ported at this time to Python 3. However there is a branch that already contains AES here.

Now how tough would it be to crack AES with a 10 to 20 character password? Very tough. If you use the most secure one (which is AES 256 at the moment) and your password consists of only numbers,upper and lower case letters. Then you would have (26+26+10 possibilities for one letter)^10 (all possible combinations). This is a huge number of passwords you'd need to try (statistically half the amount actually). Because of the complexity and CPU load AES can cause, it would take over one hundred thousand years to crack it.

share|improve this answer

I would be somewhat reluctant to use it, simply because crypto is fragile, subtle stuff. Paul Rubin (the author of p3) knows his stuff, but still. There's already a good tool for file encryption, one that has been vetted extensively by crypto experts: GPG. I would be pretty skeptical about using something new instead of the time-honored GPG.

For instance, p3 derives its crypto keys by taking a simple hash of the password. That might not be the greatest idea in the world, since passwords often don't have enough entropy. It would be better to use PBKDF2 or somesuch.

share|improve this answer
Is the main weakness of p3 the entropy of the password? Not that I have an issue with GPG, I just haven't been able to find a standalone implementation yet - they all require an installation. I'm looking for a more portable (and cross-platform) solution, hence Python. – Wayne Werner May 10 '12 at 12:16

Your Answer


