SHARE
TWEET

Untitled

a guest Nov 11th, 2019 92 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. // Iniciamos o "contador"
  4. /*list($usec, $sec) = explode(' ', microtime());
  5. $script_start = (float) $sec + (float) $usec;
  6.  
  7.  
  8. //MEU CODIGO PHP
  9. $cng = [
  10.             'options' => ['cost' => 12],
  11.             'algo' => PASSWORD_DEFAULT,
  12.             'hash' => null
  13.         ];
  14.  
  15. $form_user_password = "123456vtr";
  16.  
  17. $form_user_password_md5 = md5($form_user_password);
  18.  
  19. $password_hash = password_hash($form_user_password_md5, $cng['algo'], $cng['options']);
  20. echo $password_hash;
  21.  
  22. //MEU CODIGO PHP
  23.  
  24. // Terminamos o "contador" e exibimos
  25. list($usec, $sec) = explode(' ', microtime());
  26. $script_end = (float) $sec + (float) $usec;
  27. $elapsed_time = round($script_end - $script_start, 5);
  28. echo '<br> Elapsed time: ', $elapsed_time, ' secs. Memory usage: ', round(((memory_get_peak_usage(true) / 1024) / 1024), 2), 'Mb';
  29. */
  30.  
  31.  
  32.  
  33. $form_user_password = "123456vtr";
  34. $hash_to_compare = '$2y$12$i/J4OSSRrtXysR4b/CtZlurzlXf6jtF60zp.wspVtk6LpuDYzJ5Aa';
  35.  
  36.  
  37. // Iniciamos o "contador"
  38. list($usec, $sec) = explode(' ', microtime());
  39. $script_start = (float) $sec + (float) $usec;
  40.  
  41. //MEU CODIGO PHP
  42.  
  43. if (password_verify($form_user_password, $hash_to_compare)) {
  44.     echo 1;
  45. } else {
  46.     echo 0;
  47. }
  48.  
  49. //MEU CODIGO PHP
  50.  
  51. // Terminamos o "contador" e exibimos
  52. list($usec, $sec) = explode(' ', microtime());
  53. $script_end = (float) $sec + (float) $usec;
  54. $elapsed_time = round($script_end - $script_start, 5);
  55. echo '<br> Elapsed time: ', $elapsed_time, ' secs. Memory usage: ', round(((memory_get_peak_usage(true) / 1024) / 1024), 2), 'Mb';
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top