custom hash generated password and module wise added db password is different? function custom_submit_method(&amp;$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {    

  $cusers = $form_state-&gt;getValue(array('name'));
  $cpass = $form_state-&gt;getValue(array('pass'));



  $gh = new \Drupal\Core\Password\PhpassHashedPassword();
  $hash_password = $gh-&gt;hash($cpass);
  $check_pass = $gh-&gt;check($cpass, $hash_password);


  //  \Drupal::logger(' customusersubmit')-&gt;notice('customusersubmit submit ') ;


 //  login_finalize($cusers, $cpass);


   drupal_set_message($hash_password .'------------'. $check_pass);      
 }

Output : $S$5JdG.BjCPSTzc03AJ7aYPwMMH6HR.63IDUzqG3h2kkjG0NEcXtIo------------1 for admin

 Admin Password: $S$EnLPNV41YaHAPKhzwTGHVIir.OlOyK9ngYyEzVKdsd//WMnlaegV


When on comparing to db admin password the hash generated salt value is    different. It timely change for every runtime.

Kindly suggest me the Idea.
Yes, that is correct: The password is always salted with a different string.

If you want to verify a password, don't hash it, just check it against the value that was stored, that does work.

You're probably asking the wrong question. Explain what you're actually trying to do.