Take the 2-minute tour ×
Cryptography Stack Exchange is a question and answer site for software developers, mathematicians and others interested in cryptography. It's 100% free, no registration required.

What better Encrypt the file once with 50 characters password or encrypt it twice each time with 25 characters password.

share|improve this question
It depends. What algorithm are you planning to use, and what is the size of the file? Encrypting twice doesn't always give you double security. –  rath May 31 '13 at 11:38
@rath Plan to use AES256 (7z) and AES128 (Ax crypt), File size will be about 5Mb may be less. –  user3321 May 31 '13 at 12:48
add comment

5 Answers

up vote 11 down vote accepted

Using encryption in a non-standard way very often results in decreased security, and not in the information-theoretical sense.

Consider: you will have two different passwords. You have twice the difficulty in managing them. Twice the chances of losing them. Twice the chances someone will screw up trying to follow your complicated directions.

I also assume that you are encrypting your data because it has value. If your processes fail, all that value is destroyed. A bad encryption key is more effective than a delete button when someone screws up.

These are real world risks that will affect you directly, now and in the future. Note that none of these problems have anything to do with algorithm strength. People, processes, and protocols are the Achilles heel of security.

I recommend you place your trust in the algorithm to do its job, and spend your efforts in simplifying password and key management activities instead. It is a much better return on your security investment.

share|improve this answer
+1 for treating the system as 'peopleware' –  rath Jun 1 '13 at 11:53
The system is always peopleware. We try to ignore that because it's messy, and doesn't follow mathematical rules, but it's at the root of most security failures. –  John Deters Jun 6 '13 at 21:20
add comment

Layering encryption doesn't effectively concatenate the keys (despite what intuition may suggest). The attacker can still attack the two passwords separately, such as by using a meet-in-the-middle attack. This means the effective key space (that is, the number of possibilities for the combined password that the attacker must try) is much lower for the double-layer scheme.

Because the keys can be attacked separately, two half-length passwords do not offer as many effective combinations as one full-length password. If each character in the password has $n$ possibilities (for example, a standard keyboard might offer 26 uppercase + 26 lowercase + 10 numeric + 30 symbols = 92 characters), the 50-character password has $n^{50}$ possibilities, whereas the two 25-character passwords only provide security equivalent to $2 × n^{25}$ possibilities. Using our example numbers, that's $90^{50}$ for the single long password vs $2 \times 90^{25}$ for the two shorter ones.

For perspective, the 50-character password has about the square of the number of possibilities for two 25-character passwords. It's a lot more.

share|improve this answer
you lost me, what's better then without 'n' thing. –  user3321 May 31 '13 at 19:24
@user3321: 50 char password –  Reid May 31 '13 at 19:46
@user3321: From just the password complexity point of view, 50-char password is far, far better. –  B-Con May 31 '13 at 20:29
Could you elaborate your calculation of the number of possibilities? If I simply split my long password in two, how does the number of possibilities change? –  Paŭlo Ebermann Jun 1 '13 at 15:51
@Paŭlo: I was speaking of the effective keyspace search, not the actual number of password choices. I'll clarify the answer. –  B-Con Jun 1 '13 at 21:21
show 1 more comment

The 50 characters password option is far better. Each character added to a password makes a brute-force attack grows exponentially. Encrypt twice doesn't add much overhead. The only reason to encrypt twice is if you're using different encryption algorithms.

share|improve this answer
And if you're using any non-broken encryption algorithm, there is practically zero reason to use multiple. –  Stephen Touset May 31 '13 at 22:05
add comment

Only wanted to point out an example regarding the alghorithm Triple-Des, which, in my opinion, quite summarizes your problem: Tdes uses three 56-bit keys, which, theoretically, gives to it a strength of one 168bit key (see wikipedia http://en.wikipedia.org/wiki/Triple_DES): the alghorithm basically uses the old DES alghorithm three times: first encrypt your clear text with DES and the first key, then decrypt this result with DES and the second key, then encrypt this last result with DES and the third key. Regarding security, Tdes has been widely analyzed for years, and the crypto-analysts say: "due to the meet-in-the-middle attack, the effective security it provides is only 112 bits". But it gets worse: due to chosen-plaintext or known-plaintext attacks "it is designated by NIST to have only 80 bits of security." So, after seeing the Tdes example, encrypting once with a big key should be better than encrypting twice (or more) with smaller keys.

share|improve this answer
add comment

Encrypt a file twice with 25 characters password is not equivalent to encrypt a message with 50 character password. If you want to achieve same security as 50 character password encryption, you should encrypt the file 200 times with 25 character password.
Note that a 50 bit key is $2^{25}$ times complicated than 25 bit key not just 2 times complicated. A character(non Unicode including printable and non printable characters) has $2^8$ possibilities. So a 25 character password has a $2^{(8*25)} = 2^{200}$ possibilities, and a 50 character password has a $2^{(8*50)} = 2^{400}$ possibilities. $2^{200}$ is $2^{200}$ times complicated than $2^{400}$ so to achieve same security you should encrypt the file 200 times with 25 character independent password.
If the password is a Unicode string. A character has $17*2^{16}$ possibilities. So a 25 characters password has $17^{25}*2^{(16*25)} = 17^{25}*2^{400}$ possibilities, and a 50 characters password has $17^{50}*2^{(16*50)} = 17^{50}*2^{800}$ possibilities. So if the password is a Unicode string, to achieve same security you should encrypt the file about 500 times with 25 independent Unicode character password.

share|improve this answer
Could you elaborate your calculation? Is one character = one bit? –  Paŭlo Ebermann Jun 1 '13 at 15:48
"50 bit key" is just an example. It's clear that one character != one bit. –  ir01 Jun 2 '13 at 5:31
Yes, I was mostly referring to your first sentence. How do you get to your 26 character password? –  Paŭlo Ebermann Jun 2 '13 at 12:56
Thank you @Paŭlo Ebermann. 26 characters password is wrong. I edited my answer. –  ir01 Jun 2 '13 at 15:15
Thanks for the edit. It is still not totally clear what you are doing there with the "encrypt the file 200 times with 25 character password" – is this 200 times the same password (or key derived from the same password), or 200 independent 25-character passwords? Are you doing a 200-dimensional meet-in-the-middle attack to come to this result? Also, for your character passwords you should mention that you assume a random distribution of characters, not some sentence selected by the user. –  Paŭlo Ebermann Jun 3 '13 at 18:59
show 2 more comments

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.