docs: document collision risk for 16-char hex identity keys
Expand _compute_identity_hash docstring to explain: - Uses truncated 64-bit keys for spawned_interfaces and identity_to_address - Birthday collision risk at ~2^32 (~4 billion) identities - Astronomically safe for BLE mesh networks with <100 peers - Note that fragmenter keys use full 32-char hex for packet reassembly Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
56473837db
commit
6da7e90e5d
1 changed files with 8 additions and 1 deletions
|
|
@ -1779,11 +1779,18 @@ class BLEInterface(Interface):
|
|||
"""
|
||||
Convert 16-byte identity to 16-character hex string for interface tracking.
|
||||
|
||||
Uses truncated 64-bit hash for map keys (spawned_interfaces, identity_to_address).
|
||||
Collision risk: birthday problem collision at ~2^32 (~4 billion) identities.
|
||||
For BLE mesh networks with <100 simultaneous peers, this is astronomically safe.
|
||||
|
||||
Note: Fragmenter keys use full 32-char hex via _get_fragmenter_key() for
|
||||
maximum precision in packet reassembly.
|
||||
|
||||
Args:
|
||||
peer_identity: 16-byte peer identity (already a hash from BLE handshake)
|
||||
|
||||
Returns:
|
||||
str: First 16 hex chars of identity (8 bytes)
|
||||
str: First 16 hex chars of identity (8 bytes = 64 bits)
|
||||
"""
|
||||
# peer_identity is already the identity hash from BLE handshake
|
||||
# Just convert to hex, don't re-hash (that would corrupt the identity!)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue