Last active
October 5, 2023 08:33
-
-
Save flotwig/37121c884d2f19712935eb1bc9a55efe to your computer and use it in GitHub Desktop.
Generate a Chrome extension ID with a desired prefix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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