Skip to content

Commit

Permalink
Add rabbitmqctl / HTTP API docs for hashing password
Browse files Browse the repository at this point in the history
  • Loading branch information
lukebakken committed Feb 26, 2023
1 parent 7ddf732 commit a1deec5
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions site/passwords.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,29 @@ To do so:

## <a id="computing-password-hash" class="anchor" href="#computing-password-hash">Computing Password Hashes</a>

Sometimes it is necessary to compute a user's password hash, to updated via the [HTTP API](management.html)
or generate a [definitions file](definitions.html) to import.
Sometimes it is necessary to compute a user's password hash for updating via the [HTTP API](management.html)
or to generate a [definitions file](definitions.html) to import.

This is the algorithm:
### Hash via `rabbitmqctl`

<pre class="lang-bash">
rabbitmqctl hash_password foobarbaz

# Output:
# Will hash password foobarbaz
# 27cx5+wEi8R8uwTeTr3hk5azuV3yYxxAtwPPhCyrbdsxVhqq
</pre>

### Hash via HTTP API

<pre class="lang-bash">
curl -4su guest:guest -X GET localhost:15672/api/auth/hash_password/foobarbaz

# Output:
# {"ok":"TBybOvomyVw6BqBU/fHCEpVhDO7fLdQ4kxZDUpt6hagCxV8I"}
</pre>

### This is the algorithm:

* Generate a random 32 bit salt. In this example, we will use `908D C60A`. When RabbitMQ creates or updates a user, a random salt is generated.
* Concatenate the generated salt with the UTF-8 representation of the desired password.
Expand Down

0 comments on commit a1deec5

Please sign in to comment.