nico-castell/genpass2
CLI password generator using C and /dev/urandom
CLI Password Generator 2
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.
Usage
- 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 asgenpass2 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
xclipcommand.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
Build instructions and installation
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
Packaging the project and installing it
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 makeIf 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
rpmdevtoolsinstalled to build the package. -
If you're on Debian or another Debian based OS:
cd debian makeIf you then want to install the package:
sudo apt install ./DEBS/genpass2_1.0.2-1*.debIf you want to remove the package:
sudo apt remove genpass2
You will need to have
dpkg-devanddebhelperinstalled 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
About
This program and this repository are availabe under an MIT License.