How to programmatically reset user password
Just use the setPassword() method to update the user's password:

// Get user storage object.
$user_storage = \Drupal::entityManager()-&gt;getStorage('user');

// Load user by their user ID
$user = $user_storage-&gt;load($id);

// Set the new password
$user-&gt;setPassword('User123@');

// Save the user
$user-&gt;save();


This will take care of all the hashing for you and will trigger all the appropriate hooks for saving a user.