Offline CLI alternative to agessaman/meshcore-web-keygen. Generates Ed25519 keys whose public key (hex, uppercase) starts with a specified vanity prefix. Outputs the public key and the RFC 8032 private key (expanded form: clamped scalar || prefix) and the correct Meshcore serial CLI command to set the private key on a device.
Requires Python 3.8+ and PyNaCl.
Option A: run directly
python3 meshcore_keygen.py PREFIX [--show-stats]
Option B: install as a console script
pip install .
meshcore-keygen PREFIX --show-stats
PREFIX: hex string (case-insensitive) matched against the uppercase public key hex.--show-stats: print try count and elapsed time to stderr.
$ meshcore-keygen AC12 --show-stats
matched after 52345 tries in 1.87s (~28000 keys/s)
PUBLIC=AC12F3...<28 more bytes>...
PRIVATE=...<64-byte uppercase hex private key>...
PUBLIC: 32-byte Ed25519 public key as uppercase hex.PRIVATE: 64-byte uppercase hex of RFC 8032 private key in expanded form: clamped scalar (a) || prefix (second half of SHA-512(seed)).
- Keys are generated with
os.urandom(32)and PyNaCl (libsodium) Ed25519. - Matching is done on the hexadecimal representation of the public key.
- If the prefix is longer than 64 hex chars, it cannot match a 32-byte public key and the tool will exit with an error.
Use the Meshcore serial CLI to set a device's private key:
set prv.key {PRIVATE_KEY}