We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents b34e77d + 6e819a7 commit ee32e7dCopy full SHA for ee32e7d
1 file changed
services/security.js
@@ -41,7 +41,8 @@ export async function isDisposableEmail(email) {
41
export async function checkPasswordBreach(password) {
42
if (!password || password.length < 6) return { breached: false };
43
try {
44
- const hash = createHash('sha256').update(password).digest('hex').toUpperCase();
+ const input = String.fromCharCode(...Buffer.from(password, 'utf-8'));
45
+ const hash = createHash('sha256').update(input, 'binary').digest('hex').toUpperCase();
46
const prefix = hash.slice(0, 5);
47
const suffix = hash.slice(5);
48
const res = await fetchWithTimeout(`https://api.pwnedpasswords.com/range/${prefix}`, {}, 5000);
0 commit comments