.NET client · HIBP API v3

Know what's been pwned.

A complete, AOT-compatible client for Have I Been Pwned, with clean interfaces and privacy-first password checks.

// The plaintext never leaves your process.
var pwned = await passwordsClient
    .GetPwnedPasswordAsync("P@ssw0rd!");

if (pwned.IsPwned is true)
{
    logger.LogWarning(
        "Seen {Count:N0} times in breaches.",
        pwned.PwnedCount);
}
dotnet add package HaveIBeenPwned.Client
AOTtrim-ready
3packages
MITlicensed
OTelinstrumented
Privacy, made visible

The password check that never sends the password.

K-anonymity means the SDK hashes the password in your process, sends only five SHA-1 characters, then finds the match locally.

Explore password checks
Plaintext stays local
Password entered••••••••••••

Ready to protect the password.

  1. Inside your processHash the password
    21BD12DC183F...A757
  2. Across the networkRequest the range
    GET /range/21BD1
  3. Anonymous responseReceive a suffix bucket
    800+ suffixes
  4. Back inside your processCompare locally
    suffix match
SDK resultComparing locally...

One registration. Every client.

Add the services once. Resolve a focused interface where you need it, or the aggregate IPwnedClient when an integration touches the whole API.

Program.csC#
builder.Services.AddPwnedServices(options =>
{
    options.ApiKey = builder.Configuration["HibpOptions:ApiKey"];
    options.UserAgent = "my-service/1.0";
});

// Resolve a focused client, or the aggregate IPwnedClient.
var breaches = app.Services
    .GetRequiredService<IPwnedBreachesClient>();
HaveIBeenPwned.Client

The full client with focused interfaces and sensible defaults.

HaveIBeenPwned.Client.Abstractions

Contracts and models for clean dependency boundaries.

HaveIBeenPwned.Client.PollyExtensions

Resilience with retry-after, jitter, and circuit breaking.

Failures stay honest.

Documented 404 responses map to each operation's no-result shape. Everything else throws a PwnedApiException you can inspect. Cancellation and transport errors never turn into empty success.

Explore the reference
exception.StatusCode429
exception.RetryAfterrespected
exception.ResponseContentavailable
on 404no-result

Ship breach checks this afternoon.

Focused interfaces, privacy-first helpers, and resilience that behaves. Start with the reference.