chore(snippets): add random password generation

This commit is contained in:
Michele Cereda
2024-05-20 18:50:19 +02:00
parent ee920be22d
commit 6d021c29a2
3 changed files with 21 additions and 5 deletions

View File

@@ -214,6 +214,7 @@
"pebcak", "pebcak",
"pihole", "pihole",
"pinentry", "pinentry",
"pipx",
"pkexec", "pkexec",
"polkit", "polkit",
"portsnap", "portsnap",
@@ -267,6 +268,7 @@
"turris", "turris",
"twrp", "twrp",
"uncordon", "uncordon",
"urandom",
"userdata", "userdata",
"userdel", "userdel",
"userland", "userland",

View File

@@ -1,7 +1,5 @@
# Generate random passwords # Generate random passwords
## Table of contents <!-- omit in toc -->
1. [TL;DR](#tldr) 1. [TL;DR](#tldr)
1. [Sources](#sources) 1. [Sources](#sources)
@@ -12,12 +10,13 @@
openssl rand -base64 32 openssl rand -base64 32
gpg --gen-random --armor 1 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' date '+%s' | sha256sum | base64 | head -c '32'
cat '/dev/urandom' | LC_ALL='C' tr -dc '[:alnum:]' | fold -w '32' | head -n '1' cat '/dev/urandom' | LC_ALL='C' tr -dc '[:alnum:]' | fold -w '32' | head -n '1'
# XKCD-inspired passwords. # XKCD-inspired passwords.
pipx run 'xkcdpass' xkcdpass -d '-' -C 'random' -n 5
gopass pwgen -x --xc --xl 'en' --xn --xs '.' 3
``` ```
## Sources ## Sources
@@ -26,7 +25,8 @@ pipx run 'xkcdpass'
- [Generate a random password on Linux] - [Generate a random password on Linux]
<!-- <!--
References Reference
═╬═Time══
--> -->
<!-- Others --> <!-- Others -->

View File

@@ -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