Skip to content

Instantly share code, notes, and snippets.

@flotwig
Last active October 5, 2023 08:33
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save flotwig/37121c884d2f19712935eb1bc9a55efe to your computer and use it in GitHub Desktop.
Save flotwig/37121c884d2f19712935eb1bc9a55efe to your computer and use it in GitHub Desktop.
Generate a Chrome extension ID with a desired prefix
#!/bin/bash
# https://stackoverflow.com/a/23877974/3474615
while [[ $EXT_PREFIX != "ioio" ]] # change 'ioio' to your desired prefix (can only use lowercase a-p)
do
rm key.pem manifest_key.txt extension_id.txt
2>/dev/null openssl genrsa 2048 | openssl pkcs8 -topk8 -nocrypt -out key.pem
2>/dev/null openssl rsa -in key.pem -pubout -outform DER | openssl base64 -A > manifest_key.txt
2>/dev/null openssl rsa -in key.pem -pubout -outform DER | shasum -a 256 | head -c32 | tr 0-9a-f a-p > extension_id.txt
EXT_PREFIX=`cat extension_id.txt | cut -c 4` # change '4' to the char length of your desired prefix
cat extension_id.txt
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment