diff options
author | squahtx <squahtx@users.noreply.github.com> | 2022-08-11 20:10:43 +0000 |
---|---|---|
committer | squahtx <squahtx@users.noreply.github.com> | 2022-08-11 20:10:43 +0000 |
commit | 00ad76e3322697ea6c6f9019b0df0d50a2e894d9 (patch) | |
tree | b74ef795fcacbf08b9bc463a97907845ab64dd53 /develop/print.html | |
parent | deploy: 953df2ad88fb9fc7d1a67966c79980136321119d (diff) | |
download | synapse-00ad76e3322697ea6c6f9019b0df0d50a2e894d9.tar.xz |
deploy: e825f7366b589f61977f63d4fdc598abe052e6a0
Diffstat (limited to 'develop/print.html')
-rw-r--r-- | develop/print.html | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/develop/print.html b/develop/print.html index 33b096f578..40cf732869 100644 --- a/develop/print.html +++ b/develop/print.html @@ -10852,7 +10852,20 @@ set the displayname (optional, <code>username</code> by default).</p> <p>The MAC is the hex digest output of the HMAC-SHA1 algorithm, with the key being the shared secret and the content being the nonce, user, password, either the string "admin" or "notadmin", and optionally the user_type -each separated by NULs. For an example of generation in Python:</p> +each separated by NULs.</p> +<p>Here is an easy way to generate the HMAC digest if you have Bash and OpenSSL:</p> +<pre><code class="language-bash"># Update these values and then paste this code block into a bash terminal +nonce='thisisanonce' +username='pepper_roni' +password='pizza' +admin='admin' +secret='shared_secret' + +printf '%s\0%s\0%s\0%s' "$nonce" "$username" "$password" "$admin" | + openssl sha1 -hmac "$secret" | + awk '{print $2}' +</code></pre> +<p>For an example of generation in Python:</p> <pre><code class="language-python">import hmac, hashlib def generate_mac(nonce, user, password, admin=False, user_type=None): |