Insights For Success

Strategy, Innovation, Leadership and Security

iteration

SCrypt vs PBKDF2: A Comparative Analysis for Security Professionals

GeneralEdward Kiledjian

Key derivation functions such as SCrypt and PBKDF2 are used to turn a user's password into a cryptographic key that can be used to encrypt and decrypt data. The two algorithms are designed to be computationally expensive, making brute-force attacks on large lists of passwords difficult.

SCrypt and PBKDF2 differ significantly in the manner in which they generate keys. To generate keys, PBKDF2 applies a cryptographic function (such as SHA-1 or SHA-2) repeatedly to the password and a salt value. If the number of iterations is increased, the process will become more computationally expensive, but it will also take longer to generate a key.

SCrypt, on the other hand, generates keys using a method called "memory-hardness." A large amount of memory is used to perform calculations, making it more challenging for attackers to use specialized hardware (such as GPUs) to perform brute-force attacks. In addition, SCrypt allows users to specify a larger salt value, which increases the number of possible keys that can be generated and makes precomputation attacks more difficult.

Memory-hardness is a property of specific cryptographic algorithms that makes them computationally expensive to run, specifically in terms of memory use. Using memory-hardness, the algorithm becomes more resistant to attacks utilizing specialized hardware, such as graphics processing units (GPUs) or application-specific integrated circuits (ASICs), capable of performing many calculations simultaneously and optimized for specific purposes. By increasing the memory requirements of the algorithm, it becomes more difficult for attackers to perform brute-force attacks on these types of hardware.

Another difference between SCrypt and PBKDF2 is the number of iterations recommended. While PBKDF2 recommends a minimum of 600,000 iterations for adequate security, SCrypt does not make such a recommendation. Instead, it is determined by the cost parameter, which can be adjusted to increase or decrease the computational cost.


Keywords: SCrypt, PBKDF2, key derivation function, security, password, encryption, decryption, cryptographic key, brute-force attack, memory-hardness, iteration, salt value, precomputation attack, cost parameter, specialized hardware, threat model, security professionals, use case.

What is PBKDF2?

GeneralEdward Kiledjian

You have probably read about PBKDF2 if you have read any article discussing the LastPass hack or reviewing the security of a password manager. For non-technical readers, I wanted to write a quick explanation.

PBKDF2 (Password-Based Key Derivation Function 2) is a widely used method of protecting passwords.

A key derivation function such as PBKDF2 is designed to make it more difficult for an attacker to crack a password, even if they possess the hashed password value. This is accomplished by adding a "work factor," or iteration count, to the password hashing process. Iteration count refers to the number of times the hashing function is applied to the password, making cracking the password much more computationally costly.

PBKDF2 is widely used in a variety of applications, including online services, financial systems, and mobile devices.

With PBKDF2, the user's password is concatenated with a salt and the iteration count, and the result is then hashed using a cryptographic hash function such as SHA-256. The salt, the number of iterations, and the resulting hash value are then stored in a database. Upon logging in, the system uses the same salt, iteration count, and hash function to compare the entered password with the stored hash. The user is granted access if the values match.

It is important to use a strong and unique password and keep the salt and hashed values secure. Even though PBKDF2 is considered a strong method, more advanced key derivation functions such as bcrypt and scrypt are now available and recommended where more stringent security is required.

Keywords: PBKDF2 (Password-Based Key Derivation Function 2), Password protection, Key derivation function, Hashed password, Iteration count, Cryptographic hash function, SHA-256, Password storage, NIST guidelines, Security, Encryption, bcrypt, script, Work factor, Data privacy, Information security