Formal evaluation and analysis of Password Hashing #402
Labels
No labels
_CRITICAL_
API
app
backEnd
Blocked, waiting for further changes
bug
cleanup
close
design
duplicate
enhancement
feature request
frontEnd
help wanted
invalid
low priority
needs input
needs review
project documentation
question
research
reviewed
script
security
SQL
style
testing
topLevel
wontfix
No milestone
No project
5 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Andras/BoundlessFlowCampus2K#402
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
We need to evaluate what password encryption service to use.
Related Issues: #148
Argon2 (Argon2id)
Advantages
Designed to resist GPU/ASIC attacks through memory hardness,
Highly configurable, means that you can configure memory, time (iterations), parallelism,
Considered modern best practice,
Won the PHC (Password hashing competition) in 2015.
Disadvantages
Quite Complex to configure therefore requires careful parameter tuning,
not available in very old libraries or legacy systems.
bcrypt
Advantages
Widely supported and tested,
A single work factor (cost) makes configuration simple,
Resistant to brute force through computational cost.
Disadvantages
Not memory-hard so more vulnerable to GPU/ASIC attacks,
Has a 72-byte limit on password length.
PBKDF2
Advantages
Standardized,
Available in most languages and frameworks,
Easy to implement.
Disadvantages
Purely CPU-bound and not memory-hard making it weaker against GPU/ASIC attacks,
Requires high iteration counts for strong security.
Preferred option:
Argon2id is probably to recommend as the most suitable algorithm specifically (Argon2id), as it is designed to be resistant to both GPU and ASIC attacks, making large-scale brute-force attacks significantly more expensive for an attacker than bcrypt or PBKDF2.
bcrypt can be an acceptable alternative incase Argon2id is not available as Argon2id is newer and don't support very old libraries and legacy systems. And PBKDF2 should only be used when required.
Performance
-Slow hashing algorithms add intentional computational costs to protect from brute-force attacks, however this cost must be balanced to avoid degrading the performance off authentication for the users.
Argon2id is suitable here as well as it allows the tuning of its cost parameters specifically memory cost, time (iterations) cost and parallelism.
To balance the security and performance we can set some "hard" rules such as:
Recommending the last link if you want to read and understand the differences quickly.
What is bcrypt
What is Argon2
Password Hashing: Scrypt, Bcrypt and ARGON2
Complete Guide to PBKDF2 vs bcrypt vs Argon2 for Password Hashing
How they work
Other sensitive data such as emails.
Practical implementation of Argon2id in C#
The package can be install either as NuGet or:
Install-Package Konscious.Security.Cryptography.Argon2 -Version 1.3.0Or
dotnet add package Konscious.Security.Cryptography.Argon2Examples:
Complete implementation example
Usage example
Link:
Implement Argon2id in C#
Microsoft Official dot net package for C#
Microsoft does have an official approach to password hashing thats part of ASP.NET core identity. Unlike with Argon2id microsoft does not use Argon2 or bcrypt instead it uses PBKDF2 with SHA256.
The functionality is implemented through the PasswordHasher class which is automatically used when implementing the autoentication with ASP.NET. With it developers do not need to manually handle the salts, iterations counts or the hashing format as these are instead managed internally by the framework. This will reduced the risk of developer misconfiguration.
PBKDF2 is standardzied and widely supported which means that it works across many platforms and environments and its well tested and considered secure with a high iteration count.
From an implementation perspective, by using Microsofts built in password hasher we avoid the set-ups required when using a different hashing algorithm as it comes with .NET. This also reduces the risk of developers installing the wrong dependencies as it comes with our already downloaded VSC
Links:
Rfc2898DeriveBytes.Pbkdf2 Method Definition
PasswordHasher Class Definition
Videos
Password Hashing in C# (.NET 8, PBKDF2 + SQL Server)
b24krila referenced this issue2026-04-20 14:16:07 +00:00
Henrik kinda answered this one with: "If you have dependencies, make an evaluation and decide from that". Us group leaders will look through this evaluation and decide which one to use.
Me and @a24vinla has decided that we will use PBKDF2 as it is built into Dotnet and its easier to configure. It is also older (been around since 2000), making it unlikely to be abandoned by Microsoft as they still use it.
We should try to implement it and if the result is bad or it is harder to configure than we anticipated we could consider a change to Argon2id.
Barbecue decision has been made the issue can be closed.
We need to add this to the wiki , there exist an wiki page for it. We can basically just copy the evaluation posted here and add the conclusion to use PBKDF2 at the bottom.
Created separate issue Write wiki about our choice of password encryption #855