Files
skills/docs/security-stack/security/srp/src/groups/3072/groups-3072.md
2026-05-29 08:20:56 +01:00

2.2 KiB
Raw Blame History

groups-3072

(no submodules)

Purpose

RFC 5054 Appendix A 3072-bit safe-prime group with generator g = 5. Reachable via @suaveplan/srp/groups/3072. A 3072-bit modulus crosses the ~128-bit symmetric-security threshold and is appropriate for deployments that anticipate long secret lifetimes (multi-year auth-token rotation) or that store the verifier database in an environment with a future-quantum-threat tolerance one step above the 2048-bit default.

Features

  • N_3072 byte-exact to RFC 5054 Appendix A "3072-bit Group".
  • g_3072 = Uint8Array([5]) (RFC 5054 mandates g = 5 for this size).
  • BIT_LENGTH literal 3072.
  • Subpath-only — bundle-size cost paid only by importers.

Usage: Basic Example

import { N_3072, g_3072, BIT_LENGTH } from "@suaveplan/srp/groups/3072";

console.log(N_3072.byteLength); // 384
console.log(g_3072[0]); // 5
console.log(BIT_LENGTH); // 3072

Usage: Advanced Example

import { N_3072, g_3072 } from "@suaveplan/srp/groups/3072";
import { defaultHashBridge } from "@suaveplan/srp/hash";
import type { SrpParams } from "@suaveplan/srp/params";

const params: SrpParams = {
    N: N_3072,
    g: g_3072,
    bitLength: 3072,
    hash: defaultHashBridge("SHA256"),
    algorithm: "SHA256",
};

API Reference

Export Type Description
N_3072 Uint8Array 384-byte 3072-bit modulus.
g_3072 Uint8Array Generator 0x05.
BIT_LENGTH 3072 Literal bit length.

Implementation Notes

Unlike the 1024/1536/2048-bit groups which all use g = 2, RFC 5054 specifies g = 5 for 3072, 4096, 6144, and 8192-bit groups (the chosen generator depends on the modulus's quadratic-residue structure, picked at RFC-design time so g generates a large prime-order subgroup of Z_N*). Consumers building SrpParams from raw constants MUST use g_3072 rather than hard-coding 0x02.

modPow over a 3072-bit modulus takes roughly 4x the wall-clock time of the 2048-bit default; expect ~20–80 ms per handshake step. For interactive login this is still well under perceptual latency.