async function findPassword2(doorId) {
let [i, foundChrs] = [0, 0];
const pwd = Array(8).fill(null);
while (foundChrs < 8) {
const hash = await MD5Lib.md5(doorId + i++);
if (hash.startsWith("00000")) {
const position = parseInt(hash[5], 16);
if (position < 8 && pwd[position] === null) {
pwd[position] = hash[6];
foundChrs++;
}
}
}
return pwd.join("");
}