Created
October 16, 2024 00:29
-
-
Save xrobau/00f5f0365917ab95fa4f5d91a328317c to your computer and use it in GitHub Desktop.
MinerGunBuilder Alliance Code generator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Change your invite code, and run this as many times as you want. | |
var ic = "e0f135ef961d6d82d35346b9a578d028e6bbee3cc02f020b5d8a8421483597b8"; | |
x = generateCode(ic); | |
console.log(x); | |
function getEven(f) { | |
var e = [ 8,12,15,2,14,3,5,1,7,13,11,9,10,4,6,0]; | |
return e[parseInt(f,16)]; | |
} | |
function getOdd(f) { | |
var o = [ 15,7,3,5,13,6,14,8,0,11,12,10,1,9,4,2]; | |
return o[parseInt(f,16)]; | |
} | |
function getRand() { | |
var rand = ""; | |
// return "a06930b8c3e997d305ab984acd978248"; | |
for (var i = 0; i < 32; i++) { | |
var f = Math.floor(Math.random() * 16).toString(16); | |
rand += f; | |
} | |
return rand; | |
} | |
function generateCode(invitationCode) { | |
var m = [ 1,6,0,7,"e",8,"f","d","b",5,2,"c",3,"a",9,4]; | |
let base = invitationCode.split("").map(function (a) { return m[parseInt(a,16)]; }).join(""); | |
var rand = getRand(); | |
var r = rand.split("").reverse(); | |
for (var i = 0; i < 32; i++) { | |
var f = r[i]; | |
if (i % 2 == 1) { | |
rand += getEven(f).toString(16); | |
} else { | |
rand += getOdd(f).toString(16); | |
} | |
} | |
var code = ""; | |
for (var i = 0; i < 64; i++) { | |
code += base[i] + rand[i]; | |
} | |
return code; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment