Does encrypting plain-text data multiple times using different passwords provide a greater level of security?

If so, what encryption algorithm would be best for such a use? Would it be beneficial to use different algorithms for each iteration?

I also had an idea to use 1 algorithm if the password starts with A-N and another if the password starts with O-Z. Is something like this beneficial?

  • $\begingroup$ Comments are not for extended discussion; this conversation has been moved to chat. $\endgroup$ – e-sushi May 3 '17 at 14:26

There is a terminology gap in your question. Lets assume that you want to encrypt message $m$, and for that purpose you'll be using the encryption function $E$ such that the encrypted message will be $E(m)$. Now you ask whether your message will be more secure if you encrypt it for example as $E(E(E(m)))$. Well if this encryption is stronger than $E(m)$, then you might as well have selected in advance the algorithm $E'$ such that $E'(m)=E(E(E(m)))$. Does $E'(m)$ mean that you encrypt something 3 times? Well according to the custom terminology the answer is no, $E'(m)$ is a single iteration of the algorithm $E'$ which happens to consist of three iterations of $E$. If those three iterations were not to yield the optimal result then no one would bother to invent such algorithm $E'$. You may argue that the number of iterations represents some cost/performance tradeoff, but in this case the algorithm $E'$ would have been defined as $E'(m,n)=E^n(m)$ where $n$ is the number of iterations to employ (you'll find a similar concept in KDFs such as bscypt, scrypt, Argon2, etc. EDIT: But then a KDF is of course a one-way transformation as @tylo mentioned below, where multiple iterations do make sense). So the bottom line is that there is no such thing as "encrypting something multiple times", you'll always be just encrypting something, and this encryption may employ under the hood multiple iterations of one or more steps in the encrypting process.

Now to the point of your question, if you have multiple passwords then the strongest security you'll get is by concatenating these passwords together, pass them through a KDF, and use the resulting key for encryption. Your entropy for the entire process is the same, but if the encryption process is broken into iterations each one using only part of the entropy gives the attacker the luxury of keeping interim results and thus speeding up the cracking. So encrypting with a single iteration using a single password yields stronger encryption then multiple encryption iterations with multiple passwords which sum up to the same entropy as the password in the first option.

Concerning your idea of using different algorithms depending on password, well in that case you may leak information about your password if the attacker can guess the algorithm. So, you'll get better security by using an algorithm which is independent of message content or password.

  • $\begingroup$ Comments are not for extended discussion; this conversation has been moved to chat. $\endgroup$ – e-sushi May 3 '17 at 14:29

As mentioned in the comments, using two different algorithms with independent password does not "double" your security. Like in 3DES there would be a space time tradeoff for an attacker using a Meet-in-the-Middle-Attack (not to be confused with the term Man-in-the-Middle-Attack)

However e. g. in the following scenarios you actually gain security:

  1. One of your passwords is weak - you get (at least) the security of the stronger password.

  2. One of your passwords gets compromised. Your data is still protected as long as at least one password remains unknown to an attacker.

  3. If one of the algorithms gets broken you still have the security of the second one. (highly unlikely if you use algorithms like AES)

However the security you actually get is most likely depended on other factors: security of the computer you are using (e. g. keyloggers, spyware) , leakage (e. g. unencrypted data remaining on persistent storage)...

Regarding your second question you could use some modern 256 bit Ciphers like AES, Twofish, Serpent. Those three could be selected in TrueCrypt (also now in VeraCrypt) in combination. Keep in mind you also want to use a password based key derivation function like Scrypt or Argon to make brute forcing the password more time/memory consuming.

Selecting the encryption algorithm based on your password does not increase security. The attacker can just do the same when brute forcing your password. Generally, do not use Security by Obscurity, but rather use industry standard, open source algorithms with strong passwords.

  • $\begingroup$ Comments are not for extended discussion; this conversation has been moved to chat. $\endgroup$ – e-sushi May 3 '17 at 14:27

This question is similar. There we discussed and most people figured that its mostly a waste of time for some possible small increases in security. Mostly just use one longer password as the math is better than two short ones (if you get positive feedback after the first password is brute forced). There can be some future proofing if you use encryption A and re encrypt with B, if later one of these is broken and the other is not.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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