Migrate users and retain passwords
As @No Sssweat recommend, the D8 Migrate Modules is good way. With your way, you have to add property pre_hashed for field pass.

$values = [
  'name' =&gt; 'test',
  'mail' =&gt; 'test@test.com',
  'roles' =&gt; [],
  'pass' =&gt; [
    'value' =&gt; $hashed_drupal_7_password,
    'pre_hashed' =&gt; TRUE,
  ],
  'status' =&gt; 1,
];
$account = entity_create('user', $values);
$account-&gt;save();


You can find this property in FieldType Password