How to set a new password using a module?
Okay, I was trying to make it more complicated than it is.

The user_save() function already hashes the password. This works:

// Prepares the user object with new password
$edit = array();
$edit['revision'] = 0;
$edit['pass'] = $password;

// Saves the user object
user_save($account, $edit);


There is no need to include the password.inc and to use user_hash_password().