The toy exchange is deliberately breakable. Real DH needs large groups, authentication, and protocol checks around the arithmetic.
highlighted = computed this step
Why real DH needs more
The toy exchange has two separate failures: the group is tiny, and the public values are unauthenticated. Real deployments must fix both.
large group plus authentication
Large groups stop the toy search
The toy table recovers a=6 by brute force. Real DH uses groups with at least 2048 bits so this table is not feasible.
real groups≥2048 bits
Authentication stops the replacement
The MitM table shows Alice ending at 3 while Bob ends at 6. TLS prevents this by authenticating the exchange with certificates.
3=6
Do not roll your own
Diffie-Hellman is only one arithmetic ingredient. NOTE: toy-modulus; no-side-channel; no-production; never-roll-your-own. Protocol authentication, transcript binding, validation, and side-channel defenses are part of the deployed design.
use reviewed protocols
Summary
Toy DH is checkable and breakable; real DH needs large groups and authentication. NOTE: toy-modulus; no-side-channel; no-production; never-roll-your-own. Exact arithmetic on a deliberately tiny toy modulus; real DH uses 2048+ bit groups inside authenticated reviewed protocols.