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.

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 ?

share|improve this question
2  
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. –  Thomas Dec 21 '12 at 13:45
    
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 ? –  mary Dec 21 '12 at 14:00
    

1 Answer 1

up vote 6 down vote accepted

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)

share|improve this answer

Your Answer

 
discard

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.