printf '%s\0%s\0%s\0%s' "$nonce" "$username" "$password" "$admin" | openssl sha1 -hmac "$secret" | awk '{print $2}'

Category: Matrix & Synapse

printf '%s\0%s\0%s\0%s' "$nonce" "$username" "$password" "$admin" | openssl sha1 -hmac "$secret" | awk '{print $2}'

Compute the HMAC for shared-secret registration

Builds the MAC required by the POST register API: the nonce, username, password, and the literal string admin or notadmin, each separated by a NUL byte, hashed with HMAC-SHA1 using the registration shared secret. Set the variables first, then paste the pipeline; awk extracts just the hex digest. That digest becomes the mac field in the registration request. The same algorithm powers register_new_matrix_user.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.