This is a replacement program for the Golang based
genpass proyect. By using
C and reading the file /dev/urandom
directly, this program can achieve absurdly superior speeds when generating very large ammounts of
random data.
Note that, unlike genpass, this program does not run on Windows.
- Standalone: You can run it without arguments, and it will default to an 8 character password,
or you can specify the length as follows:
If you input a negative number (such as
genpass2 16
-128
), the program will error and tell you that it's not a valid number. Any arguments after the first will be ignored. The maximum number of characters the password can have is 4,294,967,296. Why? Because for every character in the password, we need a byte in memory. - Variable: This is the recommended way. You store the output in a variable, so the password
never appears on screen.
MY_PASS=$(genpass2 16)
- Clipboard: You can also put the password in your clipboard using the
xclip
command.genpass2 16 | xclip -selection clipboard -i
- Manpage: You can view the manpage if you need to see this information in the command line.
man genpass2
To build this project you will need two things, Meson and a C compiler.
- First, clone this repository and change directory into it:
git clone https://github.com/nico-castell/genpass2.git cd genpass2
- Second, prepare the build folder using meson:
You can also use the following flag:
meson --buildtype=release build
--prefix=~/.local # To install this program for the current user
- Use meson to build and install the project:
meson install -C build
Thanks to the use of Makefiles, packaging the project as a .rpm or .deb is very easy. Just follow these steps:
-
If you're on Fedora or another RHEL based OS:
cd rpmbuild make
If you then want to install the package:
sudo dnf install ./RPMS/$(uname -m)/genpass2-1.0.2-1.*.rpm
If you want to remove the package:
sudo dnf remove genpass2
You will need to have
rpmdevtools
installed to build the package. -
If you're on Debian or another Debian based OS:
cd debian make
If you then want to install the package:
sudo apt install ./DEBS/genpass2_1.0.2-1*.deb
If you want to remove the package:
sudo apt remove genpass2
You will need to have
dpkg-dev
anddebhelper
installed to build the package. -
You can also use the tarpkg directory to build a tar archive you can deploy in /usr/local in case your system doesn't use either dnf (rpm) or apt (dpkg).
cd tarpkg make
This program and this repository are availabe under an MIT License.