Xelone28 / 3PROJ

MIT License
0 stars 0 forks source link

Implement password hashing #97

Closed Xelone28 closed 2 months ago

Xelone28 commented 2 months ago
  1. Adaptive Hashing Algorithm PBKDF2 (Password-Based Key Derivation Function 2) is an adaptive hashing algorithm that includes key stretching techniques to make brute-force attacks more difficult. It's called "adaptive" because the algorithm's difficulty can be increased over time by adjusting parameters such as the iteration count.
  2. Salted Hash Salt: A salt is a random value added to the password before it's hashed to ensure that the same passwords do not result in the same hash across different records. This thwarts rainbow table attacks and makes cracking efforts more difficult and resource-intensive. Usage: In your implementation, a 16-byte random salt is generated for each password. This is optimal for preventing the use of pre-computed hash tables and ensuring that each hashed output is unique, even for identical passwords input by different users.
  3. Iterations Iteration Count: The number of iterations is a crucial factor in how resistant the hash will be against brute-force attacks. A higher number of iterations requires more computational power to compute the hash, thereby slowing down attackers who are trying to crack the password. Setting: You’ve set the iteration count to 10,000 in your implementation. This is considerably higher than the minimum recommended (at least 1,000), enhancing security but also considering performance.
  4. Hash Function SHA256: This is the cryptographic hash function used as part of the PBKDF2 algorithm in your implementation. SHA256 is part of the SHA-2 family and provides a good balance between speed and resistance to attacks. It produces a 256-bit hash value. Security: SHA256 remains secure for password hashing when used in PBKDF2, as the key stretching and salting mitigate many of the vulnerabilities that a standalone hash function would have.