Question

I am trying to migrate the data from Parse.com to our own servers. In order to do this, user passwords have to be migrated too. Parse.com uses standard bcrypt password encryption and passwords appear in the following format (How would I move passwords out of Parse to another server?):

$2a$10$UpoNYQ0YE/FRVrh3xt6QQeQ3HmTmskbW2Sfg5DX9fDQJnIHQd1LqG

How do I move this string to Django auth_user table so it will be accepted by Django

EDIT: I've tried adding BCrypt password hashers to settings according to shtuff.it suggestion below:

PASSWORD_HASHERS = (
    'django.contrib.auth.hashers.BCryptSHA256PasswordHasher',
    'django.contrib.auth.hashers.BCryptPasswordHasher',
    'django.contrib.auth.hashers.PBKDF2PasswordHasher',
    'django.contrib.auth.hashers.PBKDF2SHA1PasswordHasher',
    'django.contrib.auth.hashers.SHA1PasswordHasher',
    'django.contrib.auth.hashers.MD5PasswordHasher',
    'django.contrib.auth.hashers.CryptPasswordHasher',
)

And tried adding bcrypt to the beginning of the string: bcrypt$2a$10$UpoNYQ0YE/FRVrh3xt6QQeQ3HmTmskbW2Sfg5DX9fDQJnIHQd1LqG This gives me "invalid salt" message from bcrypt hasher. I also tried playing with the string and bringing it to the form bcrypt$<iterations>$<salt>$hash form or some other combinations, but could not make the "invalid salt" message go away.

Was it helpful?

Solution

Looks like you should be able to add bcrypt to PASSWORD_HASHERS in settings.py:

https://docs.djangoproject.com/en/dev/topics/auth/passwords/#using-bcrypt-with-django

OTHER TIPS

This is very stupid by me. I had to make sure that bcrypt in the initial string is followed by double $$: bcrypt$$2a$10$UpoNYQ0YE/FRVrh3xt6QQeQ3HmTmskbW2Sfg5DX9fDQJnIHQd1LqG. Marking shtuff.it answer, as it is an actually correct one.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top