Group: User Level:
Posts: 274 Joined: 9/20/2020 IP-Address: saved
|
function Alpha_MACString_Remove_Separator(mac, str) { if (!mac) return 1; let j = 0; for (let i = 0; i < 17; i++) { if (mac !== ':' && mac !== '-' && mac !== '.' && mac !== '_') { str[j++] = mac; } } return 0; }
function generateKey(argv) { const hash = ['X', 'r', 'q', 'a', 'H', 'N', 'p', 'd', 'S', 'Y', 'w', '8', '6', '2', '1', '5']; const mac = []; const key = []; const newkey = [];
Alpha_MACString_Remove_Separator(argv[0], mac); key[0] = mac[11]; key[1] = mac[0]; key[2] = mac[10]; key[3] = mac[1]; key[4] = mac[9]; key[5] = mac[2]; key[6] = mac[8]; key[7] = mac[3]; key[8] = mac[7]; key[9] = mac[4]; key[10] = mac[6]; key[11] = mac[5]; key[12] = mac[1]; key[13] = mac[6]; key[14] = mac[8]; key[15] = mac[9]; key[16] = mac[11]; key[17] = mac[2]; key[18] = mac[4]; key[19] = mac[10];
for (let i = 0; i < 20; i++) { const t = key; let index; if (t >= '0' && t <= '9') { index = t - '0'; } else { const upperCase = t.toUpperCase(); if (upperCase >= 'A' && upperCase <= 'F') { index = upperCase.charCodeAt() - 'A'.charCodeAt() + 10; } else { return 1; } } newkey = hash[index]; }
return String.fromCharCode(...newkey); }
const argv = [''+serial-number+'']; // example MAC address document.getElementById("default-password").textContent = "The password is: " + generateKey(argv); // output the generated key
|