diff --git a/.vscode/settings.json b/.vscode/settings.json index ae2dcd2..8bd71ff 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -214,6 +214,7 @@ "pebcak", "pihole", "pinentry", + "pipx", "pkexec", "polkit", "portsnap", @@ -267,6 +268,7 @@ "turris", "twrp", "uncordon", + "urandom", "userdata", "userdel", "userland", diff --git a/knowledge base/generate random passwords.md b/knowledge base/generate random passwords.md index 00ffb8c..68eb135 100644 --- a/knowledge base/generate random passwords.md +++ b/knowledge base/generate random passwords.md @@ -1,7 +1,5 @@ # Generate random passwords -## Table of contents - 1. [TL;DR](#tldr) 1. [Sources](#sources) @@ -12,12 +10,13 @@ openssl rand -base64 32 gpg --gen-random --armor 1 32 -# Print out 32 random alphanumerical characters. +# Print out 32 random alphanumeric characters. date '+%s' | sha256sum | base64 | head -c '32' cat '/dev/urandom' | LC_ALL='C' tr -dc '[:alnum:]' | fold -w '32' | head -n '1' # XKCD-inspired passwords. -pipx run 'xkcdpass' +xkcdpass -d '-' -C 'random' -n 5 +gopass pwgen -x --xc --xl 'en' --xn --xs '.' 3 ``` ## Sources @@ -26,7 +25,8 @@ pipx run 'xkcdpass' - [Generate a random password on Linux] diff --git a/snippets/generate-random-passwords.sh b/snippets/generate-random-passwords.sh new file mode 100644 index 0000000..d298922 --- /dev/null +++ b/snippets/generate-random-passwords.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env sh + +# Print out 32 random characters. +openssl rand -base64 32 +gpg --gen-random --armor 1 32 + +# Print out 32 random alphanumeric characters. +date '+%s' | sha256sum | base64 | head -c '32' +cat '/dev/urandom' | LC_ALL='C' tr -dc '[:alnum:]' | fold -w '32' | head -n '1' + +# XKCD-inspired passwords. +xkcdpass +pipx run 'xkcdpass' -d '-' -C 'random' -n 5 +gopass pwgen -x --xc --xl 'en' --xn --xs '.' 3