Skip to content

Instantly share code, notes, and snippets.

@jpalala
Created September 26, 2025 03:36
Show Gist options
  • Save jpalala/34a4b285a65b3ed4ab62b1e2e3409396 to your computer and use it in GitHub Desktop.
Save jpalala/34a4b285a65b3ed4ab62b1e2e3409396 to your computer and use it in GitHub Desktop.
leet password generator
<?php
function leetTransform($word) {
$result = "";
$vowels = ['a', 'i', 'o', 'u'];
foreach (str_split($word) as $c) {
if ($c === '-') {
$result .= '-'; // keep dash as-is
} elseif (strtolower($c) === 'e') {
$result .= '3';
} elseif (in_array(strtolower($c), $vowels)) {
$result .= strtolower($c); // vowels stay lowercase
} else {
$result .= strtoupper($c); // consonants -> uppercase
}
}
return $result;
}
$words = ["dreamed", "big", "stumbled", "often", "never", "stopped"];
// Apply randomCase to each word
$randomized = array_map("leetTransform", $words);
// Join them back with dashes
$passphrase = implode("-", $randomized);
$passphrase .= '!!';
echo $passphrase . PHP_EOL;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment