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

2.8 KiB

groups-1536

(no submodules)

Purpose

RFC 5054 Appendix A 1536-bit safe-prime group. Reachable via @suaveplan/srp/groups/1536. The 1536-bit group sits between the legacy 1024-bit floor and the modern 2048-bit default; it is rarely chosen for new deployments today but is documented in RFC 5054 for interoperability with older SRP deployments that pinned the size. Included here for completeness so a consumer migrating an existing SRP database does not have to vendor the modulus.

Features

  • N_1536 byte-exact to RFC 5054 Appendix A "1536-bit Group".
  • g_1536 = Uint8Array([2]).
  • BIT_LENGTH literal 1536.
  • Subpath-only — tree-shaken out of every consumer that doesn't import it.

Usage: Basic Example

import { N_1536, g_1536, BIT_LENGTH } from "@suaveplan/srp/groups/1536";

console.log(N_1536.byteLength); // 192
console.log(BIT_LENGTH); // 1536

Usage: Advanced Example

import { N_1536 } from "@suaveplan/srp/groups/1536";
import { defaultHashBridge } from "@suaveplan/srp/hash";
import type { SrpParams } from "@suaveplan/srp/params";

const params: SrpParams = {
    N: N_1536,
    g: new Uint8Array([2]),
    bitLength: 1536,
    hash: defaultHashBridge("SHA256"),
    algorithm: "SHA256",
};

API Reference

Export Type Description
N_1536 Uint8Array 192-byte 1536-bit modulus.
g_1536 Uint8Array Generator 0x02.
BIT_LENGTH 1536 Literal bit length.

Implementation Notes

The 1536-bit group is exported as a tree-shakeable subpath so the default 2048-bit consumer never pulls these 192 bytes into its bundle. The byte-exact correctness check lives in the spec-conformance suite, which scans every group module against the RFC 5054 Appendix A literals at test time.

A 1536-bit modPow is roughly 1.7x slower than the 2048-bit default at the language layer, but in practice falls within the same perceptual budget as the default (still under 50 ms on contemporary hardware for one handshake step). The size choice is appropriate for legacy interoperability — for greenfield deployments the 2048-bit group is preferred because it crosses the 112-bit symmetric-equivalent threshold by a comfortable margin while remaining cheaper than 3072 or 4096.

The generator g = 2 matches every other small RFC 5054 group (1024, 1536, 2048); the larger groups (3072, 4096, 6144) use g = 5 and 8192 uses g = 19. Consumers building custom SrpParams from these constants MUST use g_1536 rather than hard-coding any other value, because the generator was chosen at RFC-design time to produce a large prime-order subgroup of Z_N* — substituting an arbitrary generator would weaken the discrete-log hardness.