RobboGronk

Free MBAM Codes

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