Skip to content

Instantly share code, notes, and snippets.

@atoponce
Created September 20, 2022 01:15
Show Gist options
  • Save atoponce/9fc36cec1504943f20d50b19be4fe3fa to your computer and use it in GitHub Desktop.
Save atoponce/9fc36cec1504943f20d50b19be4fe3fa to your computer and use it in GitHub Desktop.

Pick a random 6-character word:

% grep -P '^[a-z]{6}$' /usr/share/dict/words | shuf | head -n 1
peddle

Build the passphrase using each character in "peddle" as the first character for each word in the passphrase:

% for char in p e d d l e; do
for> grep -P "^(?\!.*[[:punct:]].*)${char}[a-z]+" /usr/share/dict/words | shuf | head -n 1
for> done | paste -sd '-'
pillories-exultantly-deodorized-drained-locomotives-expediency

Check the security. 16 bits for a randomly selected 6-character word:

% grep -cP '^[a-z]{6}' /usr/share/dict/words
71687
% echo 'l(71687)/l(2)' | bc -l
16.12942389825369507247

69 bit symmetric security for random words selected starting with each character in "peddle":

% for char in p e d d l e; do
for> printf "${char}: "
for> grep -cP "^(?\!.*[[:punct:]].*)${char}[a-z]+" /usr/share/dict/words
for> done
p: 5119
e: 2604
d: 4067
d: 4067
l: 1972
e: 2604
% echo 'l(5119*2604*4067*4067*1972*2604)/l(2)' | bc -l
69.93961614462482955491

Total security is ~85 bits symmetric security:

% echo '16+69' | bc
85

Security will vary depending on the initial word chosen. Here, "jumbos" provides ~66 bits symmetric security:

% grep -P '^[a-z]{6}$' /usr/share/dict/words | shuf | head -n 1
jumbos
% for char in j u m b o s; do
for> printf "${char}: "
for> grep -cP "^(?\!.*[[:punct:]].*)${char}[a-z]+" /usr/share/dict/words
for> done
j: 577
u: 1610
m: 3320
b: 3704
o: 1556
s: 7672
% echo 'l(577*1610*3320*3704*1556*7672)/l(2)' | bc -l
66.88612174114630805659

Total symmetric security is ~82 bits:

% echo '16+66' | bc
82
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment