Skip to content

Instantly share code, notes, and snippets.

@iTrooz
Last active July 5, 2025 14:09
Show Gist options
  • Save iTrooz/58402fb3a42337a2f4b5a10ed397113c to your computer and use it in GitHub Desktop.
Save iTrooz/58402fb3a42337a2f4b5a10ed397113c to your computer and use it in GitHub Desktop.
Find words that can be typed in the same way from azerty and qwerty keyboards (e.g. for early boot password prompts)
#!/usr/bin/env python3
# Find words that can be typed in the same way from azerty and qwerty keyboards (e.g. for early boot password prompts)
A="azertyuiopqsdfghjklmwxcvbn"
Q="qwertyuiopasdfghjkl;zxcvbn"
# Common letters: ['e', 'r', 't', 'y', 'u', 'i', 'o', 'p', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'x', 'c', 'v', 'b', 'n']
common = []
for a, q in zip(A, Q):
if a == q:
common.append(a)
def only_contains_common(s: str) -> bool:
for c in s:
if c not in common:
return False
return True
WORDS = "YOUR-INPUT-PASSPHRASE-WORDS-HERE"
WORDS = WORDS.lower().split("-")
for word in WORDS:
if only_contains_common(word):
print(word)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment