Guest User

3DS / Wii U titlekey generation

a guest
May 29th, 2020
1,879
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. function secret($start,$len) {
  3.     $ret = "";
  4.     $add = $start + $len;
  5.     for ($i = 0; $i < $len; $i++) {
  6.         $ret .= pack("H*", substr(sprintf("%02x", $start), -2));
  7.         $next = $start + $add;
  8.         $add = $start; $start = $next;
  9.     }
  10.     return $ret;
  11. }
  12.  
  13. function mungetid($tid) {
  14.     while (substr($tid,0,2) == "00")
  15.         $tid = substr($tid, 2); if ($tid == "") $tid = "00";
  16.     return pack("H*", $tid);
  17. }
  18.  
  19. $SECRET = secret(-3, 10);
  20.  
  21. function derive($tid, $pass) {
  22.     global $SECRET;
  23.     return hash_pbkdf2("sha1", $pass, md5($SECRET . mungetid($tid), true), 20, 32);
  24. }
  25.  
  26. function derive_all($tid) {
  27.     $passes = ["nintendo", "mypass"];
  28.     foreach ($passes as $pass)
  29.         printf("%s : %s [%s]\n", $tid, derive($tid, $pass), $pass);
  30. }
  31.    
  32. derive_all("000100014e414150");
RAW Paste Data