Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More accurately generate the decrypted bin data #9

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 31 additions & 2 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,39 @@
});
};

function getRandomBytes(count) {
var output = new Uint8Array(count);

for (var i = 0; i < output.length; i++) {
output[i] = Math.round(Math.random() * 255);
}

return output;
}

function generateData(id) {
var arr = new Uint8Array(540);
arr[2] = 0x0F;
arr[3] = 0xE0;
// Set UID
arr.set([0x04, 0xC0, 0x0A, 0x46, 0x61, 0x6B, 0x65, 0x0A], 0x1D4);

// Set BCC, Internal, Static Lock, and CC
arr.set([0x65, 0x48, 0x0F, 0xE0, 0xF1, 0x10, 0xFF, 0xEE], 0x0);

// Set 0xA5, Write Counter, and Unknown
arr.set([0xA5, 0x00, 0x00, 0x00], 0x28);

// Set Dynamic Lock, and RFUI
arr.set([0x01, 0x00, 0x0F, 0xBD], 0x208);

// Set CFG0
arr.set([0x00, 0x00, 0x00, 0x04], 0x20C);

// Set CFG1
arr.set([0x5F, 0x00, 0x00, 0x00], 0x210);

// Set Keygen Salt
arr.set(getRandomBytes(32), 0x1E8);

// write key/amiibo num in big endian as a 64 bit value starting from offset off
var off = 0x1DC;
id = id.substring(2);
Expand Down