Context
The test/ folder had a stub Tests.cs.txt (disabled — note the .txt extension) that asserted deterministic outputs from the non-deterministic HashPassword method. Couldn't have ever passed.
Need real tests so future contributors get a green/red signal.
Done in PR #1
- xUnit project under
test/h.Tests/ that compiles the vendored PasswordHasher.cs directly (avoids ProjectReference-on-Exe awkwardness)
- 21 tests covering:
- Format/shape: 84-char base64, v3 marker prefix, salts vary across calls
- Roundtrip: HashPassword + VerifyHashedPassword succeed across ASCII / symbols / unicode passwords
- Wrong password fails, empty provided password fails
- Known-good regression fixtures: pre-computed (password, hash) pairs that must always verify
- Tampered hashes fail (suffix-mangled known hashes, must verify False)
- Cross-tool compat: a hash minted by frtl/frtl-bc/scripts/Get-PasswordHash.ps1 (pure pwsh, same v3 byte format) must verify against this build — pins the wire format as a public contract
- .github/workflows/ci.yml runs dotnet test on push to main and on every PR
Local result: Passed! - Failed: 0, Passed: 21, Skipped: 0, Total: 21
Out of scope
- Modernizing crypto defaults (the vendored hasher uses HMAC-SHA256 / 10000 iter; current ASP.NET Identity defaults to SHA512 / 100000). Behavior preserved deliberately. If we do upgrade, the regression fixtures here would need updating — but Verify still accepts both formats so existing hashes would not break.
- A Dockerfile or other distribution beyond the existing dist.sh single-file publish.
Related
- frtl/frtl-bc uses the format this tool produces — verifies migrated bcv2 hashes via the same PasswordHasher.VerifyHashedPassword path.
- frtl/frtl-bc has a scripts/Get-PasswordHash.ps1 that produces the same v3 format in pure pwsh, used as the day-to-day admin tool. This CLI is the reference verifier.
Context
The
test/folder had a stubTests.cs.txt(disabled — note the.txtextension) that asserted deterministic outputs from the non-deterministicHashPasswordmethod. Couldn't have ever passed.Need real tests so future contributors get a green/red signal.
Done in PR #1
test/h.Tests/that compiles the vendoredPasswordHasher.csdirectly (avoids ProjectReference-on-Exe awkwardness)Local result: Passed! - Failed: 0, Passed: 21, Skipped: 0, Total: 21
Out of scope
Related