A key generation tool for Aerohive access points that calculates secret keys based on device serial numbers and firmware versions.
The key generation algorithm uses a multi-step MD5 hashing process with platform-specific secrets and magic strings. The algorithm differs slightly between AP130 and AP230/305 device types.
-
Magic String Mixing: Combines platform secrets with device-specific magic strings (stored as little-endian uint32 values) and performs byte swapping operations.
-
MD5 Digest to String Conversion: Maps MD5 digest bytes (0-255) to ASCII characters using modulo 59:
- Values 0-8: Maps to '0'-'8' (ASCII 48-56)
- Values 9-33 (0x22-1): Maps to 'A'-'Y' (ASCII 65-89)
- Values 34-58: Maps to special characters (ASCII 97-121)
-
Multi-Step Hashing: Chains multiple MD5 operations, converting digests to strings between each step.
For AP230 and AP305 devices, the algorithm requires both serial number and firmware version:
- Initialize with platform secret:
TIUt8Kk5A7d4WirH - Mix magic strings with platform secret using specific swap locations
- Find the first null byte in the mixed result to determine length
- Convert platform secret to string (this step is performed but immediately overwritten)
- MD5 hash the mixed result (up to first null byte) → convert to string
- Append converted digest to serial number → MD5 hash → convert to string
- Append converted digest to firmware version → MD5 hash → convert to string
- Return final converted digest as the key
For AP130 devices, the algorithm only requires the serial number:
- Initialize with platform secret:
JPEiX5cjsbcRTP3X - Mix magic strings with platform secret using specific swap locations
- Find the first null byte in the mixed result to determine length
- MD5 hash the mixed result (up to first null byte) → convert to string
- Append converted digest to serial number → MD5 hash → convert to string
- Return final converted digest as the key
The mixing process:
- Convert magic strings from uint32 (little-endian) to bytes
- Copy platform secret to output buffer
- Append magic string bytes to output buffer
- Perform byte swaps at specific locations: positions [3, 1, 4, 5, 0, 7, 2, 6] are swapped with corresponding positions in the first 16 bytes
The device type is determined by examining characters at positions 1-3 of the serial number:
230or305: AP230/305 devices (require version parameter)130: AP130 devices (version not required)
node aerohive-keygen.js --serial=SERIAL [--version=VERSION]python3 aerohive-keygen.py --serial=SERIAL [--version=VERSION]# AP230/305 device
node aerohive-keygen.js --serial=02301601202422 --version=10.3
# AP130 device
node aerohive-keygen.js --serial=01301601202422--serial=SERIAL: Device serial number (required)--version=VERSION: Firmware version (required for AP230/305, e.g., 10.3)-h, --help: Display help message