MeshCore Packet Format and Encryption
This page covers MeshCore's packet encryption as verified from docs/packet_format.md and src/Utils.cpp in the official MeshCore repository.
MeshCoreEncryption at the Packet Format and EncryptionLevel
Packet
Each Structure Overview
MeshCore packets are compact binary structures optimized for LoRa's low-data-rate radio. A typical datamessage packet contains:is protected by AES-128 encryption followed by a 2-byte HMAC-SHA256 MAC:
[Cleartext header] [AES-128 ECB encrypted payload] [2-byte HMAC-SHA256 MAC]
Route Types
Packets carry one of four route types (from packet_format.md):
Source and destination node IDsROUTE_TYPE_FLOOD—8-bytebroadcastpublictokeysallidentifying the communicating nodes.
ROUTE_TYPE_DIRECT — ROUTE_TYPE_TRANSPORT_FLOOD — ROUTE_TYPE_TRANSPORT_DIRECT — Encryption
Path Learning (How Direct Routing Works)
MeshCore uses AES-256-CTR (Counter Mode) for payload encryption. The encryption key is derived from the sender's private key and recipient's public key using Elliptic Curve Diffie-Hellman (ECDH). Key properties of this design:
Public Key Infrastructure
Each MeshCore node generates a unique X25519 key pair on first boot. The public key serves as the node's identity (node ID). There is no central key server — the public key is distributed organically through RREQ/RREP packets and advertisement broadcasts as nodes interact with the mesh.
Message Integrity
AES-256-CTR combined with a GMAC-style MAC provides both confidentiality and integrity. A forged or corrupted packet is detected and discarded before processing.
Group / Channel Messages
Channel-level broadcast messagesmechanism (not point-to-point)AODV useRREQ/RREP):
PAYLOAD_TYPE_PATH packet containing the ROUTE_TYPE_DIRECT This mechanism reduces channel load significantly compared to Meshtastic'spure approach.flooding Allonce nodespaths configuredare withestablished.
Source: docs/packet_format.md and src/Utils.cpp in the sameofficial channelMeshCore keyrepository. canVerified read channel broadcasts.2026-05-03.
Key Comparison with Meshtastic
MeshCore's ECDH approach is more complex but stronger for direct messages — each pair of nodes has a unique shared secret. Meshtastic's shared PSK model is simpler to manage but means any node with the channel key can read all channel traffic.