Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7710579
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T01:09:40+00:00 2026-06-01T01:09:40+00:00

I am migrating a site from Drupal 7 to Django 1.4, including the current

  • 0

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 hashes passwords using SHA-512 (they are stored in the form of a string starting with “$S$”).

Django 1.4 now contains a number of options for storing passwords, with a default of SHA-256, but I can’t find an option for SHA-512. While this app appears to allow the use of SHA2 algorithms, I’m not sure it’s compatible with Django 1.4 (as 1.4 has a flexible password hasher).

What is the simplest way to do this?

ETA: I’ve built a password hasher that mimics Drupal’s algorithm and makes migration easy. Since I’ve already accepted an answer, I won’t unaccept, but for anyone who wants to do Drupal to Django migration in the future, the code is stored on Django snippets and as a GitHub gist.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T01:09:41+00:00Added an answer on June 1, 2026 at 1:09 am

    I don’t know Drupal very well, but I suppose that the passwords are stored hashed. If that’s the case, you’ll have to copy the passwords (I mean, copy them unchanged) and you’ll have to change the way Django hashes its passwords, using the exactly same way of Drupal, with the same Security Salt.

    I really don’t know how to do that, but the logic for passwords is contained in the User object. For example. the User.set_password() function (described here) uses the make_password function.

    I think with a little research you’ll find the way to change it, but the important thing is, remember that the functions must be equals! ie:

    drupal_hash(x) == django_hash(x) for every x in the allowed passwords set.

    EDIT:

    Taking a deeper look django get the has function with the get_hasher function. Now in the 1.4 version there’s a way to specify how Django will select that function. Take a look at this: https://docs.djangoproject.com/en/dev/topics/auth/#how-django-stores-passwords

    Finally, in order to create your own function, you can take a look at how it’s done on the MD5PasswordHasher. It seems really simple. You can use the hashlib python library to generate sha-512 algorithms.

    Changing the encode method would require somthing similar to:

    def encode(self, password, salt):
        assert password
        assert salt and '$' not in salt
        hash = hashlib.sha512(salt + password).hexdigest()
        return "%s$%s$%s" % (self.algorithm, salt, hash)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I m migrating my existing drupal site from one server to another . I
I am migrating my site from PHP 4 to 5 I keep getting this
While migrating our drupal site from a hosting company to our main server. I
We are considering migrating our site from flash to silverlight, and also building additional
After migrating my Drupal (6.16) installation from shared hosting to Linode VPS (Ubunto 10.04
AFter migrating a joomla 1.5 site to Drupal 6 by using Joomla to Drupal
Having spent some time migrating old data into a new drupal site, my first
I am migrating a site from ASP.NET MVC 1 to ASP.NET MVC 2. At
Short question, hopefully short answer is needed. I migrated my drupal 6 site from
I am attempting to migrate hosts and am having issues migrating from one Drupal

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.