S
S
Sergey2019-02-18 23:29:27
bash
Sergey, 2019-02-18 23:29:27

How to display the hashed password correctly?

Good afternoon, I am writing a script in BASH. It has a function for generating a password, hashing it and exporting it to the database:

GPASS=$(pwgen -cns -1 12)
GHASH=$(echo -n "$GPASS" | md5sum)

How to make it so that when importing a password into the database, only the hash is displayed: "25f9e794323b453885f5181f1b624d0b"
Without: " -"
Full hash type: "25f9e794323b453885f5181f1b624d0b -"

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Saboteur, 2019-02-18
@t3g1ng

GPASS=$(pwgen -cns -1 12)
GHASH=$(echo -n "$GPASS"|md5sum|cut -d " " -f1)

A
AVKor, 2019-02-18
@AVKor

GHASH=$(echo "$GPASS" | md5sum | cut -d" " -f1)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question