Add support for HP (upper & lowercase) i prefixed keys

This commit is contained in:
Slava Bacherikov 2020-06-15 01:10:53 +03:00
parent 7966f46c78
commit 1580bf4ac1
4 changed files with 69 additions and 5 deletions

View file

@ -17,7 +17,7 @@ Latest released version available [here][bios-pw] and latest testing version (*s
* Dell — supports such series: ``595B``, ``D35B``, ``2A7B``, ``A95B``, ``1D3B``, ``6FF1``, ``1F66``, ``1F5A`` and ``BF97``. *e.g*: ``1234567-2A7B`` or ``1234567890A-D35B`` for HDD.
* Fujitsu-Siemens — 5 decimal digits, 8 hexadecimal digits, 5x4 hexadecimal digits, 5x4 decimal digits
* Hewlett-Packard — 5 decimal digits, 10 characters
* Insyde H20 (Acer, HP) — 8 decimal digits or 10 decimal digits.
* Insyde H20 (Acer, HP) — 8 decimal digits, 10 decimal digits or HP `i ` (lowercase and uppercase) prefixed 8 digits.
* Phoenix (generic) — 5 decimal digits
* Sony — 7 digit serial number
* Samsung — 12 hexadecimal digits

View file

@ -3,7 +3,7 @@ import { asusSolver } from "./asus";
import { dellHddSolver, dellSolver, hddOldSolver } from "./dell";
import { fsi20DecNewSolver, fsi20DecOldSolver, fsi24DecSolver, fsiHexSolver } from "./fsi";
import { hpMiniSolver } from "./hpmini";
import { acerInsyde10Solver, insydeSolver } from "./insyde";
import { acerInsyde10Solver, hpInsydeSolver, insydeSolver } from "./insyde";
import {
phoenixFsiLSolver, phoenixFsiPSolver, phoenixFsiSolver,
phoenixFsiSSolver, phoenixFsiXSolver, phoenixHPCompaqSolver, phoenixSolver
@ -29,6 +29,7 @@ export const solvers: Solver[] = [
fsi20DecOldSolver,
fsi24DecSolver,
hpMiniSolver,
hpInsydeSolver,
insydeSolver,
phoenixSolver,
phoenixHPCompaqSolver,

View file

@ -1,4 +1,4 @@
import { acerInsyde10Solver, AES128, Crc64, insydeSolver, Sha256} from "./insyde";
import { acerInsyde10Solver, AES128, Crc64, hpInsydeSolver, insydeSolver, Sha256} from "./insyde";
describe("Insyde BIOS", () => {
it("Insyde key for 03133610 is 12891236", () => {
@ -46,6 +46,36 @@ describe("Acer Insyde 10 BIOS", () => {
});
});
describe("HP Insyde [i \d{8}] codes", () => {
it("Check HP Insyde solver", () => {
expect(hpInsydeSolver("i 70412809")[0]).toEqual("47283646");
expect(hpInsydeSolver("i 76205377")[0]).toEqual("41898738");
expect(hpInsydeSolver("i 52669168")[0]).toEqual("65436527");
expect(hpInsydeSolver("i 58828448")[0]).toEqual("65477807");
// user can type more spaces or use wrong case for `I`
expect(hpInsydeSolver("I 62996480")[0]).toEqual("55507825");
expect(hpInsydeSolver("i 51120876")[0]).toEqual("66775639");
expect(hpInsydeSolver("I 69779941")[0]).toEqual("54526704");
expect(hpInsydeSolver("i 75582785")[0]).toEqual("42313120");
expect(hpInsydeSolver("I 52214872")[0]).toEqual("65889633");
expect(hpInsydeSolver("i 77319488")[0]).toEqual("40986827");
expect(hpInsydeSolver("i 68852353")[0]).toEqual("55443712");
expect(hpInsydeSolver("i 59170869")[0]).toEqual("64725626");
expect(hpInsydeSolver("i 63121056")[0]).toEqual("54774419");
expect(hpInsydeSolver("i 68105474")[0]).toEqual("55798831");
expect(hpInsydeSolver("i 87267970")[0]).toEqual("10836735");
expect(hpInsydeSolver("i 93641394 ")[0]).toEqual("04454731");
// uppercase I codes
expect(hpInsydeSolver("i 51974384")[1]).toEqual("44652900");
expect(hpInsydeSolver("I 51085312")[1]).toEqual("44983934");
expect(hpInsydeSolver("I 86013615")[1]).toEqual("39971231");
expect(hpInsydeSolver("I 59170869")[1]).toEqual("46858269");
// invalid input
expect(hpInsydeSolver("51120876")).toEqual([]);
expect(hpInsydeSolver("i 511")).toEqual([]);
});
});
describe("Utils", () => {
it("sha256", () => {
expect(new Sha256(Uint8Array.from([])).hexdigest())

View file

@ -5,6 +5,8 @@
import JSBI from "jsbi";
import { makeSolver } from "./utils";
const INSYDE_SALT = "Insyde Software Corp.";
export class Crc64 {
private static tableCache: {[key: string]: JSBI[]} = {};
// ECMA 182 0xC96C5795D7870F42
@ -513,7 +515,7 @@ export function insydeAcerSwitch(arr: Uint8Array): Uint8Array {
}
// 10 digits acer key
export function acerInsydeKeygen(serial: string): string[] {
function acerInsydeKeygen(serial: string): string[] {
function rotatefun(arr: Uint8Array): Uint8Array {
const idx = arr[9] & 0xF;
let output = new Uint8Array(16);
@ -534,7 +536,7 @@ export function acerInsydeKeygen(serial: string): string[] {
}
function insydeKeygen(serial: string): string[] {
const salt1 = "Insyde Software Corp.";
const salt1 = INSYDE_SALT;
const salt2 = ":\x16@>\x1496H\x07.\x0f\x0e\nG-MDGHBT";
// some firmware has a bug in number convesion to string
// they use simple snprintf(dst, 0x16, "%d", serial) so leading zeros are lost
@ -561,6 +563,29 @@ function insydeKeygen(serial: string): string[] {
}
}
function hpInsydeKeygen(serial: string): string[] {
const inputRe = /^i\s*(\d{8})$/i;
const salt1 = "c6B|wS^8";
const salt2 = INSYDE_SALT;
const match = inputRe.exec(serial);
if (!match || match.length !== 2) {
return [];
} else {
serial = match[1];
}
let password1 = "";
let password2 = "";
for (let i = 0; i < 8; i++) {
let b: number = (salt1.charCodeAt(i) + i) ^ serial.charCodeAt(i);
password1 += (b % 10).toString();
b = (salt2.charCodeAt(i) + i) ^ serial.charCodeAt(i);
password2 += (b % 10).toString();
}
return [password1, password2];
}
export let insydeSolver = makeSolver({
name: "insydeH2O",
description: "Insyde H2O BIOS (Acer, HP)",
@ -576,3 +601,11 @@ export let acerInsyde10Solver = makeSolver({
inputValidator: (s) => /^\d{10}$/i.test(s),
fun: acerInsydeKeygen
});
export let hpInsydeSolver = makeSolver({
name: "hpInsyde",
description: "HP Insyde H2O",
examples: ["i 70412809", "I 59170869"],
inputValidator: (s) => /^i\s*\d{8}$/i.test(s),
fun: hpInsydeKeygen
});