Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 706 Vote(s) - 3.48 Average
  • 1
  • 2
  • 3
  • 4
  • 5
What function returns a Drupal-6-valid password hash?

#1
I want to make a script to insert some 100 users into a Drupal 6 database - their username, mail and password hash.

After reading about the PHP class that Drupal 6 uses, I'm not sure I can pull this off.
My method was to send every user a mail like "Hello, x! Your new password is y", then insert the hashed "y" into Drupal's user table.

I know Drupal returns an md5. But it doesn't just md5's the original password, but a very mixed-up password (using salt and other methods).

I've looked into the [Portable PHP password hashing framework][1] Drupal's using, but I don't think it works just with a copy+paste method.

So, my question is: can I make a PHP function that returns a valid Drupal 6 password hash to insert it into its user table?


[1]:

[To see links please register here]

Reply

#2
If you're creating users programmatically, you should create the plaintext password yourself, and then use the [`user_save()`](

[To see links please register here]

) function to insert the user into the database. That function will hash and save everything for you.
Reply

#3
The existing [user import][1] module looks like it would work for bulk user importing. This does not answer your "how do I hash the password" question, but it would remove the need for a custom (probably more error prone) script.


[1]:

[To see links please register here]

Reply

#4
Actually, Drupal 6 does *not* use any salt to calculate the hash of the password. Its just a simply md5 of the password

You can try this for your self. Set your password to something.

Calculate the md5 of your password (you can use this link

[To see links please register here]

for convenience).

You will find that the hash stored in the database in the `users` table in the `pass` column will be *exactly the same*

This behavior for the default installation of Drupal 6 (the behavior may have changed for Drupal 7). Only if you have some special module installed will the behavior be any different for Drupal 6.
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through