Fictitious scenario:

User accesses a restricted data (available online) identified by random string (supported by captcha to make brute-forcing more difficult).

So data is not protected by a user/password account, but each case info is identifiable and accessible to all who know such random, unique string.

What is more secure:

  1. single 10 chars random string (length is just for sake of example - could be longer)



  2. 2 x 5 chars random strings


    1. YuE9s
    2. fQGf6

Let's say the allowed chars (in random string) are: a-z, A-Z, and 0-9.

  • Depending on what you mean by "hash", the answer is "1", "2" or "what the Hell are you talking about ?". Please clarify. A "hash" usually means "the result of a hash function applied on some input", and that meaning does not make your question understandable at all.
    – Tom Leek
    Commented Jul 24, 2013 at 17:05
  • I did some edit to (hopefully) clarify.
    – Jeffz
    Commented Jul 24, 2013 at 17:14
  • By "hash" do you just mean "random string"?
    – mricon
    Commented Jul 24, 2013 at 17:25
  • I changed hash=>random string
    – Jeffz
    Commented Jul 24, 2013 at 17:32

2 Answers 2


Your "random strings" are what cryptographers would call keys: a key is a secret value with no implied internal structure (as opposed to a password which is "a key which fits in a human brain").

In your first case, users will be granted access based on their ability to present a specific sequence of 10 characters in the a-zA-Z0-9 alphabet. These are 62 possible signs, so there are 6210 = 839299365868340224 possible keys. An attacker trying to force his entry in will have to "guess" the sequence, which he cannot do except by trying possible keys in any order (we assumed "no implied internal structure", which means "uniform probability"). On average, the attacker will have to try half of the possible keys before succeeding, and that's 419649682934170112.

Now suppose that we are in the second case: the user will be accepted only if he enters two 5-character strings in two text fields. Both values are to be right if access is to be granted. In that situation, there are 625 combinations for each string, for a grand total of 625*625 = 839299365868340224 possibilities, which is exactly the same count as previously, so it does not matter.

That is, unless you botch it. "Botching it" would mean, here, telling the user if he got one of the two 5-character strings correct, even if the other is not. For instance, the two entry fields are in successive pages, and your server will show the second page only if the first string was correct. In that case, the attacker can crack both 5-character strings one after the other: that's 625/2 = 458066416 tries on average for the first string, then 458066416 again for the second string. The attacker then succeeds in (on average) 916132832 tries, i.e. 458066416 faster than with the non-botched implementation. That's what I call an epic fail. (Such a failure has already happened, from Microsoft themselves.)

It is simpler, and safer, to require entry of all 10 characters in one go. How you display them, as one text field, two text fields, or a bunch of heart-shaped balloons floating in the screen, has no importance, as long as you do not leak information about which ones are correct. The only information that the verification system should give is whether all characters were correct, or at least one was not.


Let me first make sure I understand your scenario. What you are saying is essentially that some data is restricted essentially by a password that is shared by everyone. So, it's not a user/password combination, but it's a universal password right?

If that is the case, having one "password" of length 10 is more secure, ASSUMING that the two passwords would be guessed one after another. Specifically, if the attacker was told which of the passwords were wrong, then it would be easier because instead of being n^5 * n^5 it would be n^5 + n^5 = 2n^5.

However, if you only tell the user whether both passwords are correct or not, then they would be equally secure, at least from a mathematical perspective. If you also put them on separate pages with separate captchas and only told the user if both were correct or not, then this would be even more secure because the attacker would have to load two web pages, thus taking more time and also having to do another captcha which also takes more time. This seems rather impractical though seeing as how incredibly annoying it would be for your users. I would hate to do that myself.

In effect, you might as well have one password of length 10, but if for some reason you had restrictions on passwords being length at most 5, as long as they can't tell that a single password is right or wrong, they are the same.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .