Take the 2-minute tour ×
Information Security Stack Exchange is a question and answer site for Information security professionals. It's 100% free, no registration required.

I understand that a hashing algorithm like bcrypt uses several rounds of hashing to make it computationally expensive for a brute-force attack. How does encryption work against a brute-force attack? I was wondering if a stolen encrypted file such as one encrypted with GnuPG can be cracked much much faster than a bcrypt hash of the same password assuming it is 10 char long using A-Za-z0-9!~?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

To encrypt a piece of data, you need an encryption key. An encryption key has to be a long, random string. Passwords do not fit this criteria. So if you want to use a password as an encryption key, you need to use a key derivation function. Strong password hashing algorithms like pbkdf2, bcrypt and scrypt are key derivation functions.

So to answer your question, it depends. It depends on which KDF the application is using to stretch the password into an encryption key. GnuPG does use a KDF function (controlled by the --s2k-* set of flags).

share|improve this answer
1  
Technically, bcrypt is not a true KDF, but its output is sufficient large (192 bits) that it can be used for generating symmetric keys. Similarly, PBKDF2 is a KDF, but it can still be used for password hashing. –  Thomas Pornin Feb 16 at 4:24

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.