2
$\begingroup$

assume we say 128bit keys are secure so a 16 character long password is safe, but if i even use lower case and upper case letters with numbers and special characters on my keyboard its about 80 different character i can choose, as we have 256 different byte in nature so it look like the 16 character random password i choose is about a 60 bit secure key ... ?! how to fix it and what is secure length to use ?

$\endgroup$
3
  • 2
    $\begingroup$ 16 character password $\neq$ 128 bits of entropy. To fix it, either add more characters to your password, or use a slow KDF (key derivation function) to add some more bits of security to your key in the form of computational cost, see PBKDF2, bcrypt, scrypt, ... you can probably get an extra 24 bits at most before this becomes inconvenient to the user. $\endgroup$
    – Thomas
    Dec 21, 2012 at 13:45
  • $\begingroup$ well Thomas most of crypto tools such as Trucrypt etc always ask you enter your password don't say import a key, so password is what we use in real life not keys because it must be something we remember .. so what is correct password length with a regular keyboard for 128bit security ? $\endgroup$
    – mary
    Dec 21, 2012 at 14:00
  • $\begingroup$ See security.stackexchange.com/questions/6095/… and en.wikipedia.org/wiki/Password_strength $\endgroup$
    – mikeazo
    Dec 21, 2012 at 14:44

1 Answer 1

9
$\begingroup$

If your alphabet (set of all possible characters) has size $s$ and your password has length $l$, a randomly generated password has a strength of $\log_2s^l = l\cdot\log_2s = l\cdot\frac{\log_{10}s}{\log_{10}2}$ bits.

This means if you want to create a 128-bit password using a 80-character alphabet, you need at least $\left\lceil128\cdot\frac{\log_{10}2}{\log_{10}80}\right\rceil = \left\lceil20.25\right\rceil = 21$ characters.

In practice, humans aren't very good at creating random passwords; and the greater the alphabet gets, the greater gets the bias. Non-random password (e.g., sets of dictionary words) are even worse (as low as 1 bit of entropy per character).

If possible, you should generate your passwords randomly (with a program, not by hand) and store them with a password manager, or use a KDF (as Thomas already suggested in the comments). Trucrypt actually uses PBKDF2 for key derivation. (source)

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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