1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
<?php
$h = strtoupper(sha1("your_password"));
$c = curl_init("https://api.pwnedpasswords.com/range/" . substr($h, 0, 5));
curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
$n = curl_exec($c);
echo "Hash: " . $h . "<br>";
$r = explode("\r\n", $n);
$p = false;
foreach ($r as $i) {
	$l = explode(":", $i);
	if (substr($h, 5) === $l[0]) {
		echo "<span style=\"color:#ff0000\">${l[0]}: ${l[1]} times</span>";
		$p = true;
	}
	else
		echo "${l[0]}: ${l[1]} times";
	echo "<br>";
}
if ($p)
	echo "Pwned!";