Below is a simple code snippet that allows you to convert a password hashed using MD5 into the format that can be used by Drupal 8. This can be useful if you are creating users programmatically and need to re-create their password from an MD5 source.
/** @var \Drupal\Core\Password\PhpassHashedPassword $password_service */ $password_service = \Drupal::service('password'); // U will indicate that the password needs rehashing. // Method is the same as in Drupal 7. See user_update_7000() for more info.