# Migrating users from a sha256 password

**URL:** <https://community.auth0.com/t/migrating-users-from-a-sha256-password/103271>\
**Category:** Get Help\
**Tags:** user-import-export, user-management\
**Created:** [March 24, 2023, 4:55pm UTC](https://community.auth0.com/t/migrating-users-from-a-sha256-password/103271 "2023-03-24T16:55:36Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![inspiran](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@inspiran](https://community.auth0.com/u/inspiran)\
**Post date:** [March 24, 2023, 4:55pm UTC](https://community.auth0.com/t/migrating-users-from-a-sha256-password/103271/1 "2023-03-24T16:55:37Z")

</div>

Hello,

passwords for our users were initially made using sha256\_crypt.hash() in python resulting in following format : $5$rounds=535000$qgfr4.Ky9h/ODeTk$ByU6XFDg1UIUAboU/mOWP7v55h46x0hjdBHVQhaLtP4

Unfortunately the passwords do not match after importing users. The json contains the algorithm, hash and salt. Not sure though if the position of the salt is prefix,.

```auto
 "custom_password_hash": {
      "algorithm": "sha256",
      "hash": {
        "encoding": "base64",
        "value": "QnlVNlhGRGcxVUlVQWJvVS9tT1dQN3Y1NWg0NngwaGpkQkhWUWhhTHRQNA=="
      },
      "salt": {
        "position": "prefix",
        "value": "qgfr4.Ky9h/ODeTk"
      }
    },

```

Python code used to construct the json part:

```auto
            parts = original_password.split('$')
            password_bytes = parts[4].encode('ascii') #get the hash
            password_base64_bytes = base64.b64encode(password_bytes)
            password_data = password_base64_bytes.decode("ascii")

"custom_password_hash": {
                "algorithm": "sha256",
                "hash": {
                    "value": password_data,
                    "encoding": "base64"
                },
                "salt": {
                    "value": parts[3],
                    "position": "prefix"
                }
            }

```

Any help would be appreciated! Kind regards, Daniel

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [March 27, 2023, 8:09pm UTC](https://community.auth0.com/t/migrating-users-from-a-sha256-password/103271/3 "2023-03-27T20:09:06Z")

</div>

Hi @inspiran,

Welcome to the Auth0 Community!

I understand you are having trouble with a password hash import, I’ll look into it and get right back to you.

Thanks,  
Dan

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [March 28, 2023, 1:12pm UTC](https://community.auth0.com/t/migrating-users-from-a-sha256-password/103271/4 "2023-03-28T13:12:55Z")

</div>

What library are you using?

---

<div class="post-metadata">

**Author:** ![inspiran](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@inspiran](https://community.auth0.com/u/inspiran)\
**Post date:** [March 28, 2023, 1:24pm UTC](https://community.auth0.com/t/migrating-users-from-a-sha256-password/103271/5 "2023-03-28T13:24:45Z")

</div>

Hi Dan,

We are using  
[https://passlib.readthedocs.io/en/stable/lib/passlib.hash.sha256\_crypt.html](https://passlib.readthedocs.io/en/stable/lib/passlib.hash.sha256_crypt.html)

encrypted\_pwd = sha256\_crypt.encrypt(plain\_text\_password)

---

<div class="post-metadata">

**Author:** ![inspiran](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@inspiran](https://community.auth0.com/u/inspiran)\
**Post date:** [April 4, 2023, 4:47pm UTC](https://community.auth0.com/t/migrating-users-from-a-sha256-password/103271/6 "2023-04-04T16:47:18Z")

</div>

Any update on your findings Dan?

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [April 7, 2023, 6:30pm UTC](https://community.auth0.com/t/migrating-users-from-a-sha256-password/103271/7 "2023-04-07T18:30:29Z")

</div>

Hi @inspiran,

Apologies for the delay. I did a deep dive on this and discovered that you are limited to a max of 10k rounds for SHA256

If you don’t have those, then you will need to import users without hashes. Here’s a resource on that:

> **[Import and Export Users](https://auth0.com/docs/manage-users/user-migration)**
>
> Overview of importing users from external applications into Auth0.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [June 26, 2023, 5:38pm UTC](https://community.auth0.com/t/migrating-users-from-a-sha256-password/103271/9 "2023-06-26T17:38:27Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
