password
Linux

How to generate password hash using OpenSSL

OpenSSL is used to encrypt and decrypt data, generate SSL certificate to secure connections, generate password hash and of course other operation.

There is several tools to generate password hash, In this tutorial, we will see how to generate it with OpenSSL in a system like Linux.

Why do you need to Hash password?

When you store a user’s password, you must ensure that you have it secured in such a way that if your data is compromised, you don’t expose your user’s password.

So you should never store a password in plain text you have to generate hash.

Generate password hash using OpenSSL :

Here is the command to use :

openssl passwd <algorithm> password

Here is the algorithm that can be used :

MD5 = -1

SHA256 = -5

SHA512 = -6

APR1 = -apr1

AIX MD5 = -aixmd5

For example, to generate a hash using SHA512 use the command below :

[root@linux ~]# openssl passwd -6 P@ssw0rd
$6$VZL66DqnlCuL.db7$btAw.vfj7nIhB9miVgjp4ZK53k54pTnm18fqcsNYT0DQ1Y9lEqH6YZF9TxQFwS0mn1Y6cxm74d66n/6FLZxfG1

To see this article in French click here.

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *