Skip to content

Commit ee32e7d

Browse files
authored
Merge pull request #41 from ZeroHost-Code/beta
v1.2.1
2 parents b34e77d + 6e819a7 commit ee32e7d

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

services/security.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ export async function isDisposableEmail(email) {
4141
export async function checkPasswordBreach(password) {
4242
if (!password || password.length < 6) return { breached: false };
4343
try {
44-
const hash = createHash('sha256').update(password).digest('hex').toUpperCase();
44+
const input = String.fromCharCode(...Buffer.from(password, 'utf-8'));
45+
const hash = createHash('sha256').update(input, 'binary').digest('hex').toUpperCase();
4546
const prefix = hash.slice(0, 5);
4647
const suffix = hash.slice(5);
4748
const res = await fetchWithTimeout(`https://api.pwnedpasswords.com/range/${prefix}`, {}, 5000);

0 commit comments

Comments
 (0)