From 8616243660f6a041229034639d78114c281998cf Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Tue, 26 Feb 2019 08:12:18 +0200 Subject: [PATCH] use gpg to generate passwords --- README.md | 1 - pash | 40 ++++++---------------------------------- pash.1 | 6 +----- 3 files changed, 7 insertions(+), 40 deletions(-) diff --git a/README.md b/README.md index 9242726..ea9ec03 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,6 @@ OPTIONS −c Copy password to clipboard. −l Length of generated passwords. -−n Limit passwords to alphanumeric characters. −q Don't print password to stdout. -t Print list output as a tree. −h Show usage and exit. diff --git a/pash b/pash index e4a5414..306bc62 100755 --- a/pash +++ b/pash @@ -7,13 +7,14 @@ pw_add() { case $REPLY in [yY]) - [[ $OSTYPE == linux* ]] && - check_entropy - - pw_gen + length=${length:=50} + password=$("${gpg[0]}" --armor --gen-random 0 "$length") + password=${password:0:length} ;; - *) read -rsp "Enter password: " password ;; + *) + read -rsp "Enter password: " password + ;; esac [[ $password ]] || @@ -60,33 +61,6 @@ pw_list() { printf '└%s\b┘\n' "${nest//\//──┴}" } -pw_gen() { - [[ -r /dev/urandom ]] || - die "/dev/urandom is not readable." - - mapfile -tn "${length:=50}" rand