Skip to main content

Get the leaked-password suffixes of a SHA-1 prefix

GET/v2/compromised-password-hashes/ranges/{hashPrefix}
API version
v2
Request method
GET
Operation ID
hibp-get-compromised-password-hash-range

Returns the suffixes of leaked passwords that share the first five hex characters of their SHA-1 hash, in the range format of Have I Been Pwned: one SUFFIX:COUNT line each, with 35 uppercase hex characters per suffix. Covers the public Pwned Passwords corpus and the hashes collected from our own incidents. Anyone may call it without authentication; the gateway rate limits it per IP address, or per user for authenticated callers. Credentials with a restricted scope may receive the empty degraded answer even though an anonymous request succeeds. A failed or timed-out lookup answers 200 with an empty body, both availability headers false and Cache-Control: no-store.

Request​

  • hashPrefixstringrequired

Responses​

Response headers
  • X-Hibp-Internal-Availablestring (one of: true, false)

    false when the compromised hash store failed; the lines then hold the Pwned Passwords entries only.

  • X-Hibp-Upstream-Availablestring (one of: true, false)

    true when the Pwned Passwords lookup answered; on false the lines hold our hashes only.

Usage examples​

$ curl \
--fail \
--location \
-H "Authorization: Bearer $MITTWALD_API_TOKEN" \
https://api.mittwald.de/v2/compromised-password-hashes/ranges/5BAA6
import { MittwaldAPIV2Client } from "@mittwald/api-client";
import { assertStatus } from "@mittwald/api-client-commons";

const client = MittwaldAPIClient.newWithToken(process.env.MITTWALD_API_TOKEN);
const response = await client.hibp.getCompromisedPasswordHashRange({
"hashPrefix": "5BAA6"
});

assertStatus(response, 200);

use \Mittwald\ApiClient\Generated\V2\Clients\Hibp\GetCompromisedPasswordHashRange\GetCompromisedPasswordHashRangeRequest;

$client = MittwaldAPIClient::newWithToken(getenv('MITTWALD_API_TOKEN'));

$request = (new GetCompromisedPasswordHashRangeRequest(
hashPrefix: "5BAA6"
));
$response = $client->hibp()->getCompromisedPasswordHashRange($request);

var_dump($response->getBody();

On this page