Add support for Insyde bios codes
This commit is contained in:
1 parent
2bab662137
commit
cf4232191e
2 files changed
+43
No files matched your search
@@ -161,6 +161,30 @@ function HPMiniSolver(serial: string): string[] {
|
||||
}
|
||||
}
|
||||
|
||||
/* Maybe need fixing for browsers where numbers is 32-bits */
|
||||
/* Some Acer, HP laptops. 8 digit */
|
||||
function InsydeSolver(serial: string): string[] {
|
||||
const salt = "Iou|hj&Z";
|
||||
let password = "";
|
||||
let b = 0;
|
||||
let a = 0;
|
||||
let ord = (str: string) => str.charCodeAt(0);
|
||||
for (let i = 0; i < 8; i++) {
|
||||
b = ord(salt.charAt(i)) ^ ord(serial.charAt(i));
|
||||
a = b;
|
||||
// a = (a * 0x66666667) >> 32;
|
||||
a = (a * 0x66666667);
|
||||
a = Math.floor(a / Math.pow(2, 32));
|
||||
a = (a >> 2) | (a & 0xC0);
|
||||
if (a & 0x80000000) {
|
||||
a++;
|
||||
}
|
||||
a *= 10;
|
||||
password += (b - a).toString();
|
||||
}
|
||||
return [password];
|
||||
}
|
||||
|
||||
export let Sony: BIOSDecoder = {
|
||||
model: BIOSModels.Sony,
|
||||
name: "Sony",
|
||||
@@ -190,6 +214,14 @@ export let HPMini: BIOSDecoder = {
|
||||
solve: HPMiniSolver
|
||||
};
|
||||
|
||||
export let Insyde: BIOSDecoder = {
|
||||
model: BIOSModels.Insyde,
|
||||
name: "Insyde H2O",
|
||||
examples: ["03133610"],
|
||||
check: (s) => /^\d{8}$/i.test(s),
|
||||
solve: InsydeSolver
|
||||
};
|
||||
|
||||
export let Decoders: BIOSDecoder[] = [
|
||||
Sony, Samsung, HPMini
|
||||
];
|
||||
|
||||
@@ -37,4 +37,15 @@ describe("Decryp BIOS", function() {
|
||||
expect(bios.HPMini.check("CNU12$4ABC")).toBe(false);
|
||||
expect(bios.HPMini.check("CNU12п4ABC")).toBe(false);
|
||||
});
|
||||
|
||||
it("Insyde key for 03133610 is 12891236", function() {
|
||||
expect(bios.Insyde.solve("03133610")).toEqual(["12891236"]);
|
||||
});
|
||||
|
||||
it("Insyde input validation", function() {
|
||||
expect(bios.Insyde.check("12345678")).toBe(true);
|
||||
expect(bios.Insyde.check("123456789")).toBe(false);
|
||||
expect(bios.Insyde.check("1234o678")).toBe(false);
|
||||
expect(bios.Insyde.check("12345678d")).toBe(false);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user