From 9afd54927365e41bc12692e02bd910a3e743c6a2 Mon Sep 17 00:00:00 2001 From: Philip H <47042125+pheiduck@users.noreply.github.com> Date: Wed, 26 Jun 2024 13:03:14 +0200 Subject: [PATCH 1/3] Add: Generate.bcrypt.hash.md Thanks to: @mathys-lopinto --- Generate.bcrypt.hash.md | 45 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 Generate.bcrypt.hash.md diff --git a/Generate.bcrypt.hash.md b/Generate.bcrypt.hash.md new file mode 100644 index 00000000..5a5a9ae2 --- /dev/null +++ b/Generate.bcrypt.hash.md @@ -0,0 +1,45 @@ +# How to generate bcrypt + +## Prerequisites +- Python 3 +- bcrypt library + +## Prerequisites Installation +### Windows +Download and install Python 3 from [official website](https://www.python.org/downloads/). +Check "Add python.exe to PATH" before running "Install Now". + +Open Command Prompt (win + r, type "cmd" and press enter) and run the following command to install bcrypt library: +```bash +pip install bcrypt +``` + +### Debian based distributions +```bash +sudo apt-get update +sudo apt-get install python3 python3-pip +# If you use have install python using apt +sudo apt-get install python3-bcrypt +# If don't install python using apt +pip3 install bcrypt +# If you got externally-managed-environment error +pip3 install bcrypt --break-system-packages +``` + +## Generating bcrypt +### Do not name the file `bcrypt.py` as it will cause an error. +Create a python file with the following content: +```python +import bcrypt +password = b"your_password_here" # DO NOT REMOVE THE b +hashed = bcrypt.hashpw(password, bcrypt.gensalt()) +print(f'The hashed password is: {hashed.decode()}') + +docker_interpolation= hashed.decode().replace("$", "$$") +print(f'The hashed password for an docker env is: {docker_interpolation}') +``` + +Replace `your_password_here` with the password you want to hash. + +Run the python file and you will get the hashed password. +Copy the 2nd line of the output (after the : ) and use it as your hashed password. From e7e374cfd7b727944029e06ed46341b0f6502a53 Mon Sep 17 00:00:00 2001 From: Philip H <47042125+pheiduck@users.noreply.github.com> Date: Wed, 26 Jun 2024 18:11:02 +0200 Subject: [PATCH 2/3] comment: created by --- Generate.bcrypt.hash.md | 1 + 1 file changed, 1 insertion(+) diff --git a/Generate.bcrypt.hash.md b/Generate.bcrypt.hash.md index 5a5a9ae2..92d51532 100644 --- a/Generate.bcrypt.hash.md +++ b/Generate.bcrypt.hash.md @@ -1,3 +1,4 @@ + # How to generate bcrypt ## Prerequisites From 8044c53815081e7ba842a0da04409f6f291a14b0 Mon Sep 17 00:00:00 2001 From: Philip H <47042125+pheiduck@users.noreply.github.com> Date: Thu, 27 Jun 2024 10:18:09 +0200 Subject: [PATCH 3/3] add: Fedora and Arch Linux install guide --- Generate.bcrypt.hash.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Generate.bcrypt.hash.md b/Generate.bcrypt.hash.md index 92d51532..8adb2972 100644 --- a/Generate.bcrypt.hash.md +++ b/Generate.bcrypt.hash.md @@ -27,6 +27,30 @@ pip3 install bcrypt pip3 install bcrypt --break-system-packages ``` +### Fedora based distributions +```bash +sudo dnf update +sudo dnf install python3 python3-pip +# If you use have install python using apt +sudo dnf install python3-bcrypt +# If don't install python using apt +pip3 install bcrypt +# If you got externally-managed-environment error +pip3 install bcrypt --break-system-packages +``` + +### Arch Linux based distributions +```bash +sudo pacman -Syy +sudo pacman -S python python-pip +# If you use have install python using apt +sudo pacman -S python-bcrypt +# If don't install python using apt +pip3 install bcrypt +# If you got externally-managed-environment error +pip3 install bcrypt --break-system-packages +``` + ## Generating bcrypt ### Do not name the file `bcrypt.py` as it will cause an error. Create a python file with the following content: