Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function isID1(id1) {
- /*
- 1) Take your id1
- 24A90106478089A4534C303800035344
- 2) Split it into u16 chunks
- 24A9 0106 4780 89A4 534C 3038 0003 5344
- 3) Reverse them backwards
- 5344 0003 3038 534C 89A4 4780 0106 24A9
- 4) Endian flip each of those chunks
- 4453 0300 3830 4C53 A489 8047 0601 A924
- 5) Shuffle them around with the table on 3dbrew (backwards!)
- 0601 A924 A489 8047 3830 4C53 4453 0300
- 6) Join them together
- 0601A924A489804738304C5344530300 <-- cid
- */
- var p1=[];
- for (var i=0;i<8;i++) {
- p1.push(id1.substr(i*4,4));
- }
- console.log(p1);
- var p2=[];
- for (var i=0;i<8;i++) {
- p2.push(p1[7-i].substr(2,2) + p1[7-i].substr(0,2));
- }
- console.log(p2);
- var p3=[p2[6],p2[7],p2[4],p2[5],p2[2],p2[3],p2[0],p2[1]];
- console.log(p3);
- var p4=[];
- for (var i=0;i<8;i++) {
- p4.push(p3[i].substr(0,2));
- p4.push(p3[i].substr(2,2));
- }
- console.log(p4);
- return (p4[15] == "00" && (p4[1] == "00" || p4[1] == "01"))
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement