Follow along with the video below to see how to install our site as a web app on your home screen.
Note: this_feature_currently_requires_accessing_site_using_safari
#!/bin/bash
# Configuration
MIN_LENGTH=12
MAX_LENGTH=16
SPECIAL_CHARS='!@#$%^&*_+-='
# Hash-based password generation
generate_hash_based_password() {
local phrase="${1:-$(date +%s)}" # Use timestamp if no phrase provided
# Validate input
if [ -z "$phrase" ]; then
echo "Error: Please provide a passphrase" >&2
return 1
fi
# Echo the passphrase and generate password
echo "Passphrase: $phrase"
# Generate SHA-256 hash and format
local hash=$(echo -n "$phrase" | sha256sum | cut -c1-12 | tr '[:lower:]' '[:upper:]')
local special_char=${SPECIAL_CHARS:$((RANDOM % ${#SPECIAL_CHARS})):1}
local number=$((RANDOM % 10))
echo "Generated password: ${hash}${special_char}${number}"
}
# Original random password generation
chars='^#$%&_+='
{ </dev/urandom LC_ALL=C grep -ao '[A-Za-z0-9]' \
| head -n$((RANDOM % 4 + 5))
echo ${chars:$((RANDOM % ${#chars})):2} # Random special char.
echo
} \
| shuf \
| tr -d '\n'
echo
# Prompt for passphrase
echo "=== Hash-based Password ==="
echo -n "Enter your passphrase: "
read -r passphrase
# Generate a hash-based password using the entered passphrase
generate_hash_based_password "$passphrase"
# Generate random password
echo -e "\n=== Random Password ==="
echo -n "Random password: "
cat /dev/urandom | tr -dc 'A-Za-z0-9#$%^&*+' | head -c 12
echo