Last Updated on February 21, 2020 by admin
Insight: Multiple Way To Generate a Strong Pre-Shared Key (PSK) in Linux
This blog post is for you if you are looking for the answer to your question ” How to generate a strong pre-shared key (PSK) in Linux based operating system.
In this article, we will use multiple ways to generate a strong pre-shared key in Linux based operating system.
Multiple Way To Generate a Strong Pre-Shared Key (PSK) in Linux
1. Using GPG Command
GPG is a command-line tool that is used to provide digital encryption and signing services. It uses the OpenPGP standard. To generate a strong pre-shared key, you need to use its
--gen-random option. Run the following command to generate the password.You might get confused in the following example, 1 or 2 is the quality level and 20, 40, and 70 are the character counts.
gpg --gen-random 2 20 | base64 gpg --gen-random 1 40 | base64 gpg --gen-random 2 70 | base64
2. Using OpenSSL Command
You can use the rand option to generate the strong PSK password in Linux.
openssl rand -base64 32 openssl rand -base64 64
3. Using date and sha245sum Commands
The date and sha256sum command can be used together in Linux to create a strong PSK as follows.
date | sha256sum | base64 | head -c 45; echo date | sha256sum | base64 | head -c 50; echo date | sha256sum | base64 | head -c 60; echo
4. Using Pseudorandom Number Generators
The last option in our article is using pseudorandom number generators to create a strong password in Linux.
$ head -c 35 /dev/random | base64 $ head -c 60 /dev/urandom | base64