# Export password hashes in the PHC format

**URL:** https://meta.discourse.org/t/export-password-hashes-in-the-phc-format/133805
**Category:** Self-Hosting
**Tags:** how-to
**Created:** [November 19, 2019, 3:38pm UTC](https://meta.discourse.org/t/export-password-hashes-in-the-phc-format/133805 "2019-11-19T15:38:49Z")
**Posts on this page:** 1
**Showing post:** 9

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [January 4, 2021, 10:30pm UTC](https://meta.discourse.org/t/export-password-hashes-in-the-phc-format/133805/9 "2021-01-04T22:30:21Z")

</div>

Hey @angus, we’re cleaning things up here.

Is it true that the OP code block should read:

```plaintext
SELECT id, username,
  concat(
    '$pbkdf2-sha256$i=64000,l=32$',
    replace(encode(users.salt::bytea, 'base64'), '=', ''),
    '$',
    replace(encode(decode(password_hash, 'hex'), 'base64'), '=', '')
  ) as phc
FROM users

```

and include something like:

For more information about importing Discourse passwords to Auth0 see [Bulk User Import Custom Password Hash Issue - Auth0 Community](https://community.auth0.com/t/bulk-user-import-custom-password-hash-issue/47408).

To move data from Auth0 to Discourse, this might help: [Migrated password hashes support](https://meta.discourse.org/t/migrated-password-hashes-support/19512).

---

_[View the full topic](https://meta.discourse.org/t/export-password-hashes-in-the-phc-format/133805)._
