A small C++17 command-line decoder for known-key Motorola ADP voice on P25
Phase 1 (ALGID 0xAA). It takes a captured recording, demodulates it, strips
the P25 FEC, applies the ADP RC4 keystream, and decodes the 88-bit IMBE frames
to 8 kHz PCM.
It was built from the private XTS 5000 test captures and the validated ADP
notes in this folder. The reference Python scripts are kept under reference/
for provenance; deadp is the standalone implementation.
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build -jThe only dependency is a C/C++ compiler and CMake. There are no runtime libraries to install.
# SDR# baseband WAV (16-bit stereo I/Q, 1.024 MS/s): clear + ADP call
./build/deadp decode -i capture.wav -k 0123456789 -o out.wav
# 8 kHz discriminator, signed 16-bit little-endian
./build/deadp decode -i capture.i16 -k 0123456789 -o out.wav
# Raw RTL-SDR 8-bit unsigned I/Q
./build/deadp decode -i capture.cs8 --rate 2048000 -k 0123456789 -o out.wav
# p25_dump frame text; inspect or convert without decoding
./build/deadp frames -i capture.i16 -o frames.txt
./build/deadp decode -i frames.txt -k 0123456789 -o out.wavThe key is the 40-bit ADP key as 10 hex digits (the examples use a placeholder;
use the key the recording was made with). --kid N additionally requires a matching key ID; without it the
algorithm ID is checked but the KID is ignored. --mode adp forces decryption
of every voice unit (useful when a frame dump starts mid-call and has no HDU),
--mode clear never decrypts, and the default --mode auto follows the
ALGID/KID advertised by the HDU and LDU2.
--dump-frames FILE writes the demodulated units in the same text format as
the P32 p25_dump2 helper, so the Python tools under reference/ still work.
| Format | Detection | Notes |
|---|---|---|
iq / wav |
.wav, or --format iq |
SDR# baseband: stereo 16-bit, decimated 1/128 to 8 kHz, atan2 discriminator |
i16 |
.i16, or --format i16 |
8 kHz discriminator, little-endian signed 16-bit |
cs8 |
.cs8, or --format cs8 |
raw RTL-SDR unsigned 8-bit I/Q; use --rate |
frames |
.txt, or --format frames |
F <n> <duid> alg=.. kid=.. mi=.. dumps |
For IQ input the sample rate must be an integer multiple of 8000. Raw cs8
defaults to 1024000 samples/s; pass --rate 2048000 for 2.048 MS/s captures.
Mono 8 kHz WAV files are treated as discriminator audio.
This is the validated layout from reference/P25_ADP_HANDOFF.md:
- FEC-decode the 18-byte on-air voice frame to the 11-byte IMBE payload.
- Build
material = key[5] || MI[0..7]. - RC4 KSA over
material; discard the first 256 PRGA bytes (i = j = 0after the KSA, as in standard RC4-drop256). - XOR the IMBE payloads with the keystream:
- LDU1 voice frame
f: offset11 + 11*f - LDU2 voice frame
f: offset112 + 11*f
- LDU1 voice frame
- Decode the plaintext 88-bit codeword with the fixed-point IMBE vocoder.
MI/superframe rules:
- The HDU MI keys the first superframe.
- LDU1 and LDU2 of a superframe use the same MI.
- The MI carried by LDU2 keys the next superframe; that LDU2 itself uses the previous MI.
The vocoder is reset at every HDU (new call), including the synthesis PRNG and the fixed-point overflow/carry flags, so a clear call followed by an ADP call in one recording does not leak codec state across calls.
scripts/validate.sh checks the implementation against the captured material:
ADP_KEY=<40-bit-key> ./scripts/validate.shThe captures and the real key are private local material and are not part of the public repository, so the script skips any checks whose input is absent.
All checks pass:
- the 1 kHz tone capture decrypts to the confirmed tone;
- the phrase capture decrypts (
AD8NT Radio Check Count 12345); - the 8 kHz discriminator demodulates to the reference frame dump;
- the
i16and frame-text paths produce identical PCM; - the full SDR# WAV (clear call followed by ADP call) decodes end to end;
- the raw 2.048 MS/s
cs8pair capture decodes end to end; - the clear reference path is unchanged.
Only SHA-256 sums are stored in tests/expected/; the decrypted WAVs and the
captures stay local (see captures/README.md).
The checked-in proof was written by reference/python/adp_decrypt_pattern.py,
which decoded the tone file first and then the phrase file in the same
process without resetting the IMBE vocoder. Its first frames therefore carry
tone codec state. DeADP resets at each HDU, so its output differs at the sample
level but uses the same decrypted IMBE payloads; tests/expected/adp-phrase.wav
is the fresh-codec reference.
src/ deadp CLI, WAV/raw I/O, IQ front-end, frame text, ADP decoder
vendor/p32/ vendored P25 demod/FEC/ADP and the fixed-point IMBE vocoder
reference/ private handoff notes, Python proof scripts, old helpers, UI shots
captures/ private recordings and decrypted listening copies (not committed)
tests/expected/ SHA-256 regression sums (audio itself is not committed)
scripts/validate.sh end-to-end regression check
- The ADP key, the recordings, and the decrypted audio are private test material. Do not commit or redistribute them.
- ADP is Motorola proprietary/patented. Encryption on amateur frequencies is generally prohibited; only decode material you are authorized to receive.
vendor/p32/core/p25/p25_adp.cis MIT. The demodulator, FEC, call decoder, and IMBE vocoder carryGPL-3.0-or-laterSPDX headers, so DeADP as a whole is distributed under the GNU GPL v3 or later. SeeCOPYINGandvendor/p32/README.md.