Grok-Pedia

password-hashing

Password Hashing

Password hashing is a method used to protect passwords stored in databases or systems from being accessed by unauthorized parties. This cryptographic process transforms a password into another fixed-length value known as a hash, which ideally cannot be reversed or decrypted to reveal the original password.

History and Context

The concept of hashing passwords has roots back to the early days of computing where simple encryption methods were used. However, as computers became more powerful and cryptographic attacks more sophisticated, the need for more secure methods became evident:

Key Concepts

Salting

Salting involves adding a unique, random string of characters to each password before hashing. This makes the hash unique even if two users have the same password, complicating dictionary and rainbow table attacks. The salt should be stored alongside the hash, as it's not secret but rather used to ensure uniqueness.

Work Factor

The work factor, often known as the cost parameter, defines the computational cost of hashing. Increasing this value makes the hash function take longer to compute, providing more resistance against brute-force attacks. For example, in bcrypt, this is known as the 'cost' parameter.

Hash Functions for Passwords

Not all hash functions are suitable for password storage due to their speed and design:

Implementation Considerations

References

Recently Created Pages