Sorry for the confusion. Clarification:
Copying over the hashes from D7 to D8 works (I made a mistake with a backslash in the JSON output)!
So just copy over the D7 hashes (starting with $S$) from the D7.users.pass field to the D8.users_field_data.pass field. It will work. The first time, that the users logs in to the new D8 site, the password gets rehashed with the D8 algorithm (PhpassHashedPassword.check() and PhpassHashedPassword.needsRehash() are doing the magic).
Everything is fine :-) Thanks.
EDIT: Someone requested the code for this...
Here is my controller class that imports all the Drupal 7 users found in the file asde2.users.json:
public function importAsde2Users() {
// load asde2 user file
$usersfile = $_SERVER['DOCUMENT_ROOT']."/".drupal_get_path('module', 'preosuser')."/asde2.users.json";
PxLog::debug($this, "Loading asde2 users file ".$usersfile);
// decode json array of objects
$users = json_decode(file_get_contents($usersfile));
PxLog::debug($this, "Found ".count($users)." Users in that file");
$database = \Drupal::database();
// import all of them
foreach ($users as $user) {
$newuser = \Drupal\user\Entity\User::create([
'name' => $user->name,
'pass' => $user->pass,
'mail' => $user->mail,
'status' => $user->status,
'init' => $user->init,
'created' => $user->created,
'login' => $user->login,
'access' => $user->access,
'uid' => $user->uid,
]);
$newuser->addRole("xx");
$newuser->addRole("yy");
$newuser->save();
// dirty overwrite re-hashed hash
$database->merge('users_field_data')
->fields(['pass' => $user->pass])
->keys(array('uid' => $user->uid))
->execute();
}
return ['#markup' => "Created ".count($users)." Users with that file", '#cache' => ['max-age' => 0]];
}
Have fun.