Importing wordpress (ver 3 and 4) users to Drupal 7, how to solve password problem

So importing data from WP is not so hard, you can do it in different ways, mapping data as you need. But what to do about passwords. they are encrypted, WP uses "one-way encryption" and you will need hacker to know what is in them. There are 2 methods.

1. Copy paste

Seems like drupal and WP use pretty similar techniques for encryption. We tested them and most passwords do match when you copy values. So a-z, A-Z, 0-9 and chars !#$%&()=?*;:_,.- all work, which is most from standard keyboard. What we found out is that quotes " and ' dont work and break the password. Also we dont know about special chars per language but even ????? which we have in out language work, so it might be only this quotes that are the problem.

So then you can basically just shoot into drupal sql commands to add hash values to tables. Dont use it with user_save as they you will be hashing already hashed values.

2. hook_login

Other method is to make it with hook login. This came from friend of mine and its quite brilliant. Put whatever you want for users password and then on users login in, check if the user never logged to know it is his first time, if it is then use the password he has just types and check it with password on WP database, use WP functions to check if his email and pass match and if so then on drupal side save what user just typed as NEW password and add it to database, this way you will get passwords to drupal with help of a user and evrebody is happy.

p.s.
First method could also work for other versions, we didnt try it, second method will work for every version, forever.