To update the md5 password to the hashed one I needneeded to use user_hash_password() and concact an 'U'. Here is the script that I used to make it work.
<?php
require_once DRUPAL_ROOT . '/' . variable_get('password_inc', 'includes/password.inc');
$res = db_query('select * from drupal.users');
if($res) {
foreach ($res as $result) {
$hashed_pass = user_hash_password($result->pass, 11);
if ($hashed_pass) {
$hashed_pass = 'U' . $hashed_pass;
db_update('users')->fields(array('pass' => $hashed_pass))->condition('uid', $result->uid)->execute();
}
}
}
Then I ran
drush scr <name_of_the_script_file>
And it worked.