Migrate passwords from Drupal 7 to Django

前端 未结 4 1014
南方客
南方客 2021-02-08 10:36

I am migrating a site from Drupal 7 to Django 1.4, including the current users. How can I work with the passwords that were hashed by Drupal?

According to this, Drupal 7

4条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-08 10:56

    You should be able to implement this by creating your own subclass of BasePasswordHasher, and adding it to your PASSWORD_HASHERS setting.

    Python's hashlib implements sha512.

    The page David linked to in the question explains how the number of iterations (16385 for Drupal 7) is encoded in the hash, but it's not clear to me how to get the salt.

    Edit: In the comment to @santiago's answer, David says the "the salt is the 5th character through the 12th in the stored Drupal string".

提交回复
热议问题