Hi Sameer, i generate the password directly in the database with the follow PHP code:
$password_hashed = password_hash('password_to_encrypt', PASSWORD_DEFAULT);
For more information, review the PHP function 'password_hash', and Moodle use 'blowfish' encryption.