Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.             function isID1(id1) {
  2.                 /*
  3.         1) Take your id1
  4.             24A90106478089A4534C303800035344
  5.         2) Split it into u16 chunks
  6.             24A9 0106 4780 89A4 534C 3038 0003 5344
  7.         3) Reverse them backwards
  8.             5344 0003 3038 534C 89A4 4780 0106 24A9
  9.         4) Endian flip each of those chunks
  10.             4453 0300 3830 4C53 A489 8047 0601 A924
  11.         5) Shuffle them around with the table on 3dbrew (backwards!)
  12.             0601 A924 A489 8047 3830 4C53 4453 0300
  13.         6) Join them together
  14.             0601A924A489804738304C5344530300 <-- cid
  15.     */
  16.                 var p1=[];
  17.                 for (var i=0;i<8;i++) {
  18.                     p1.push(id1.substr(i*4,4));
  19.                 }
  20.                 console.log(p1);
  21.                 var p2=[];
  22.                 for (var i=0;i<8;i++) {
  23.                     p2.push(p1[7-i].substr(2,2) + p1[7-i].substr(0,2));
  24.                 }
  25.                 console.log(p2);
  26.                 var p3=[p2[6],p2[7],p2[4],p2[5],p2[2],p2[3],p2[0],p2[1]];
  27.                 console.log(p3);
  28.                 var p4=[];
  29.                 for (var i=0;i<8;i++) {
  30.                     p4.push(p3[i].substr(0,2));
  31.                     p4.push(p3[i].substr(2,2));
  32.                 }
  33.                 console.log(p4);
  34.                 return (p4[15] == "00" && (p4[1] == "00" || p4[1] == "01"))
  35.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement