Migrating sha1 user passwords into drupal 7 I have an old zend 1.8 cms site and I wish to import users into a drupal 7 site so that a user can login with their sha1 password without having to changing it. Once verified convert the submitted password to drupal 7 password in the users table. I would guess I would need to import users without their passwords into the users table and create a separate table to store their sha1 passwords in the database. I would be very grateful if someone can point me in the right direction to achieve this.

&lt;?php
$str = 'password';//Users password

if (sha1($str) === '5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8') {//from imported users table
    echo "Your password is valid";
    //let user into the site 
    //insert into user.pass table password $str $S$DUygh2WJWU3caajVD3mgjIHShYgOTbaZnt9uC8lf6fMNo9lX50nr
}
?&gt;
You can use the Migrate framework and easily import accounts into Drupal 7 and it will take care of this for you. Don't bother with separate tables and password lookups and all that.

https://www.drupal.org/project/migrate

https://www.jeffgeerling.com/blogs/jeff-geerling/migrating-drupal-7-users-site

I can't find an actual example of a class that handles users into Drupal 7,
but the Migrate docs are very thorough.

Edit - here is an example: https://cgit.drupalcode.org/migrate/tree/migrate_example/beer.inc#n212

But in your case you will want to define another database connection in settings.php and define that as the source of the migration.