defaultGenerator top-level property

BigInt defaultGenerator
final

Default generator for SRP group operations.

The value 2 is the standard generator from RFC5054. It offers:

  • Computational efficiency (modular exponentiation is just a left shift).
  • Does not have to match the generator used to create the safe prime.
  • Widely supported in SRP implementations.

Note: When using a custom safe prime with this generator, you must verify that g^q mod N ≠ 1 (where g = 2, N = safe prime, q = (N-1)/2) to ensure it generates the large order-q subgroup. Use verifyGenerator for this.

You can override this by specifying a custom generator when creating User or Server instances.

Implementation

final defaultGenerator = BigInt.from(2);