A generator is a group element whose repeated application under the group operation produces every element of the group or a specified subgroup. In Diffie–Hellman, participants agree on a prime number p and a generator g, using group structure to support the exchange. section 5.2.1 section 5.2.3
Keep the practical role in view:
- Treat g as a shared parameter, not as a private secret. section 5.2.3
- Understand g through the group it belongs to: Diffie–Hellman uses a multiplicative group, with multiplication as its operation. section 5.2.1
- Choose parameters conservatively; custom or incorrectly standardized groups have previously been weak or broken. section 5.2.3
A generator inside a modular group
Picture the integers modulo 5 as a clock that wraps back to 0. Its multiplicative subgroups contain the identity element 1 and can have different orders. A generator is the element whose repeated multiplication visits every member of the selected group or subgroup. section 5.2.1

