Skip to content

Instantly share code, notes, and snippets.

@marklister
Created April 23, 2019 15:39
Show Gist options
  • Save marklister/940ee0106006fd9c2b65ea413a3e9c93 to your computer and use it in GitHub Desktop.
Save marklister/940ee0106006fd9c2b65ea413a3e9c93 to your computer and use it in GitHub Desktop.
Wireguard vanity genkey
#!/bin/bash
# "Vanity" keygen for Wireguard
# Example usage: ./vanity-genkey '^CPT/|^HRE/|^EDI/'
# Or on a multi core machine ./vanity-genkey '^CPT/|^HRE/|^EDI/' >> keys &
# Spawn as many as your computer can deal with.
# Adding -i to the grep will speed things up at the expense of readability
PUB=""
while [ -z "$PUB" ];
do
PVT=$(wg genkey)
PUB=$(echo $PVT | wg pubkey | grep -E $1)
done
echo $PVT
echo $PVT | wg pubkey | grep --color -E $1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment