Advertisement
anhkiet2507

MalwareBytes Key Generator

Aug 23rd, 2019
30,722
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.73 KB | None | 0 0
  1. <?php
  2. // EXAMPLE USAGE
  3. for ($i = 0; $i < 100; $i++) {
  4.   $array = generate();
  5.   echo $array[0];
  6.   echo ":";
  7.   echo $array[1];
  8.   echo "<br>";
  9. }
  10.  
  11.  
  12. // FUNCTION
  13. function generate()
  14. {
  15.         $digilist = "0123456789ABCDEFGHJKLMNPQRTUVWXY";
  16.  
  17.         //now we generate a new random ID number using the substrings of the digitList string above
  18.         $id = NULL;
  19.         $id .= substr($digilist, rand(1, 9), 1); //random number
  20.         $id .= substr($digilist, rand(10, 31), 1); //then a letter
  21.         $id .= substr($digilist, rand(10, 31), 1); //another letter
  22.         $id .= substr($digilist, rand(1, 9), 1); //a number
  23.         $id .= substr($digilist, rand(1, 9), 1); //and finally another number - simple :D
  24.                        
  25.     //ok so now we need to generate an MD5 hash of our ID
  26.         $hash = md5($id);
  27.  
  28.         //cycle through the hash 16 (length of key) times (in steps of 2 because each hex bytes is 2 digits long)
  29.         $i = 0;
  30.         $key = NULL;
  31.         for ($i; $i < 32; $i+=2)
  32.         {
  33.                 //here we convert the next hex value to an integer and perform a bitwise AND operation against '31'
  34.                 //31 is the highest substring value in our digit list.  
  35.                 $nextdigit = hexdec(substr($hash, $i, 2)) & 31;
  36.  
  37.                 //if 'i' is divisable by 8 (every 4 cycles) then we want to add "-"
  38.                 if ((($i % 8) == 0) && ($i > 0))
  39.                 {
  40.                         $key .= "-".substr($digilist, $nextdigit, 1);
  41.                 }
  42.                 else
  43.                 {
  44.                         $key .= substr($digilist, $nextdigit, 1);
  45.                 }
  46.         }
  47.  
  48.         $array = array($id, $key);
  49.         //return
  50.         return $array;
  51. }
  52. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement