uparrow To top page of drpartha.org.in uparrow







Generate and check passwords

drpartha@gmail.com

Principles of cryptography

There are of course many tools in *n?x for generating passwords.

pwgen is my most favorite tool. pwgen offers a wide choice of options. Here is a sample of what pwgen can do for you.

But, you may like to try making a home-grown tool of your own. Use these simple one-line shell scripts, to generate your own passwords of any length:
  1. Method #1 :
    uptime | sha256sum | head -c 32 ; echo
    Make passwords 32 characters long.
  2. Method #2 :
    uptime | md5sum | head -c 8 ; echo
    Make passwords 8 characters long.
You can also use gpg or openssl to generate random strings.

gpg --gen-random --armor 1 32

In my case, just now, the result was: 6lS7cgCyT9vkCZIDQIXcgbXk7bkoVZqdZ0U4HZ4RJw8=

$ openssl rand -base64 32

Similarly, with OpenSSL: the output is: CrUk9dNutlsCErYv5U19ZWP0Pe9GwQgwdDgUNEapXjk=

You now have a real tough/strong password.

You can build more elaborate shell scripts, using the above one-line scripts. These scripts can also be useful whenever you want to generate random text strings e.g. for OTP, for CAPTCHA challenges, for misc. testing.

Here are some simple examples (you can improve upon them or customise them, any way you want):
  • Use this Bash script for generating one (or more) OTP (with mixed text and numbers)
  • Use this one-line script to give you any desired number of passwords (say 20) of a given length (say 16 char long):
    for i in user{01..20} ; do echo "$i $( pwgen 16 1 )" ; done
  • Use this simple bash script, if you want a numeric PIN.


You may like to test the "strength" of your password, before using it for any serious purpose. Try this password strength meter. The javascript code used is also available (with permission of the original author) for download and inspection.

In order to determine if the password is strong enough, you can use cracklib (a Javascript script).

$ echo "123abcd" | cracklib-check

If you do this, you will get: abcd1234: it is too simplistic/systematic

And if you use a normal word?:

$ echo "admin" | cracklib-check

admin: it is based on a dictionary word


Administrivia -- $$publications$$


This file is located at :
https://drpartha.org.in/drpartha/genpass.htm
This file was last modified on (mm/dd/yy): 05/13/20
Send comments/suggestions to : drpartha@gmail.com
Page developed by: Algologic
Do not miss : Our Warning and Disclaimer page.
We support standards

Go to TOP hotair