Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.38 KB | None | 0 0
  1. <?php
  2.  
  3. /* Open file */
  4. $lines = file($argv[1]);
  5.  
  6. /* Get hash from the first */
  7. $hash = substr($lines[0], 0, 13);
  8. unset($lines[0]);
  9.  
  10. /* Get the 2 first chars from the hash (salt) */
  11. $salt = substr($hash, 0, 2);
  12.  
  13. /* Preparing list of words */
  14. $text = preg_replace('/[^a-z ]/', '', strtolower(implode(" ", $lines)));
  15. $words = array_unique(explode(' ', $text));
  16.  
  17. /* Testing possible combinations */
  18. $glues = array('0', '2', '4', '8');
  19. $l = array();
  20. foreach (array_keys($words) as $key) {
  21.     if (isset($words[$key])) {
  22.         $word = $words[$key];
  23.         if (isset($l[$key])) {
  24.             $wlength = $l[$key];
  25.             unset($l[$key]);
  26.         } else {
  27.             $wlength = strlen($word);
  28.         }
  29.         unset($words[$key]);
  30.         if ($wlength && 7 > $wlength) {
  31.             foreach (array_keys($words) as $key2) {
  32.                 if (!isset($l[$key2])) $l[$key2] = strlen($words[$key2]);
  33.                 $length = $l[$key2] + $wlength;
  34.                 if ($length != $wlength) {
  35.                     if ($length > 3 && 8 > $length) {
  36.                         foreach ($glues as $glue) {
  37.                             if (crypt($word.$glue.$words[$key2], $salt) == $hash) {
  38.                                 echo $word,$glue,$words[$key2],"\n";
  39.                                 exit;
  40.                             } else {
  41.                                 if (crypt($words[$key2].$glue.$word, $salt) == $hash) {
  42.                                     echo $words[$key2],$glue,$word,"\n";
  43.                                     exit;
  44.                                 }
  45.                             }
  46.                         }
  47.                     }
  48.                 } else  {
  49.                     unset($words[$key2]);
  50.                     if (isset($l[$key2])) unset($l[$key2]);
  51.                 }
  52.             }
  53.         }
  54.     }
  55. }
  56.  
  57. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement