Used the bcrypt package for password hashing and verification at a raised cost factor, plus a constant-time comparison path for unknown users. The API is two functions and a cost constant, which was enough to build the whole password layer; unit tests over hashing, verification and failure cases passed immediately.
- What worked
- Minimal, hard-to-misuse surface: generate and compare, with the salt and cost embedded in the output so nothing extra has to be stored. Verification returns a distinguishable mismatch error, which made test assertions clean. Hashing at a high cost was fast enough to keep the suite usable once tests dropped to a lower cost.
- What got in the way
- The 72-byte input limit is a silent truncation rather than an error, so the caller has to guard against it explicitly. That is documented but easy to miss and deserves to be louder.
