# Are encrypted passwords created via \`htpasswd\` command line compatible with node-red's decryption mechanism?

**URL:** https://discourse.nodered.org/t/are-encrypted-passwords-created-via-htpasswd-command-line-compatible-with-node-reds-decryption-mechanism/63460
**Category:** General
**Created:** [4 June 2022 17:54 UTC](https://discourse.nodered.org/t/are-encrypted-passwords-created-via-htpasswd-command-line-compatible-with-node-reds-decryption-mechanism/63460 "2022-06-04T17:54:10Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Shan](https://avatars.discourse-cdn.com/v4/letter/s/7ab992/32.png) [@Shan](https://discourse.nodered.org/u/Shan)
#### Post date: [4 June 2022 17:54 UTC](https://discourse.nodered.org/t/are-encrypted-passwords-created-via-htpasswd-command-line-compatible-with-node-reds-decryption-mechanism/63460/1 "2022-06-04T17:54:10Z")

</div>

I do not wish to use the `node-red admin` CLI tool to generate an admin password for my Editor. I understand after going through the code of `node-red-admin` that it uses `bcrypt` with Cost value of 8.

I tried creating a password using `htpasswd` as follows:

```auto
httppasswd -nBb -C 8 admin P0puloStack

```

The generated password:

```auto
$2y$08$252IoQIYqn/kxOesjtej2eO8/60.o.cnLLbYXSxNJ3gVlwto5khCu

```

I added the password as an Environment variable so that my docker container can try to spin up node-RED and I tried logging in but to no possible success.

Is there anyway to try to decrypt the password using `node-red admin` CLI in the container to see if the password checked?

---

<div class="post-metadata">

### Author: ![Shan](https://avatars.discourse-cdn.com/v4/letter/s/7ab992/32.png) [@Shan](https://discourse.nodered.org/u/Shan)
#### Post date: [4 June 2022 18:29 UTC](https://discourse.nodered.org/t/are-encrypted-passwords-created-via-htpasswd-command-line-compatible-with-node-reds-decryption-mechanism/63460/2 "2022-06-04T18:29:05Z")

</div>

```auto
node-red-admin hash-pw

```

for the same plaintext password provides a very different hash to that of `htpasswd` i.e.,

`node-red-admin` generates with `$2b$` variant while as `$2y$` is generated by `htpasswd`. Athough they may be compatible

However, an interesting thing [javascript - $2y bcrypt hashes in Node.js - Stack Overflow](https://stackoverflow.com/questions/36041533/2y-bcrypt-hashes-in-node-js)

I replaced the `$2y$` with `$2a$` and it works.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [18 June 2022 18:30 UTC](https://discourse.nodered.org/t/are-encrypted-passwords-created-via-htpasswd-command-line-compatible-with-node-reds-decryption-mechanism/63460/3 "2022-06-18T18:30:00Z")

</div>

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