Initial Commit
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
# `groups-6144`
|
||||
|
||||
<!-- begin:auto-docs -->
|
||||
_(no submodules)_
|
||||
<!-- end:auto-docs -->
|
||||
## Purpose
|
||||
|
||||
RFC 5054 Appendix A 6144-bit safe-prime group with generator `g = 5`. Reachable via `@suaveplan/srp/groups/6144`. Niche size, included for completeness with RFC 5054. Use only when interoperating with an existing deployment that pinned this size; modern greenfield deployments should choose 2048-bit or 4096-bit instead, since 6144 imposes ~27x the `modPow` cost of 2048 without a proportional security headroom over 4096.
|
||||
|
||||
## Features
|
||||
|
||||
- `N_6144` byte-exact to RFC 5054 Appendix A "6144-bit Group".
|
||||
- `g_6144 = Uint8Array([5])`.
|
||||
- `BIT_LENGTH` literal `6144`.
|
||||
- Subpath-only.
|
||||
|
||||
## Usage: Basic Example
|
||||
|
||||
```ts
|
||||
import { N_6144, g_6144, BIT_LENGTH } from "@suaveplan/srp/groups/6144";
|
||||
|
||||
console.log(N_6144.byteLength); // 768
|
||||
console.log(BIT_LENGTH); // 6144
|
||||
```
|
||||
|
||||
## Usage: Advanced Example
|
||||
|
||||
```ts
|
||||
import { N_6144, g_6144 } from "@suaveplan/srp/groups/6144";
|
||||
import { defaultHashBridge } from "@suaveplan/srp/hash";
|
||||
import type { SrpParams } from "@suaveplan/srp/params";
|
||||
|
||||
const params: SrpParams = {
|
||||
N: N_6144,
|
||||
g: g_6144,
|
||||
bitLength: 6144,
|
||||
hash: defaultHashBridge("SHA256"),
|
||||
algorithm: "SHA256",
|
||||
};
|
||||
```
|
||||
|
||||
## API Reference
|
||||
|
||||
| Export | Type | Description |
|
||||
| ------------ | ------------ | -------------------------- |
|
||||
| `N_6144` | `Uint8Array` | 768-byte 6144-bit modulus. |
|
||||
| `g_6144` | `Uint8Array` | Generator `0x05`. |
|
||||
| `BIT_LENGTH` | `6144` | Literal bit length. |
|
||||
|
||||
## Implementation Notes
|
||||
|
||||
A 6144-bit `modPow` is roughly 27x slower than the 2048-bit default and typically not worth the cost compared to either 4096 (similar headroom against precomputation, ~3x faster) or 8192 (significantly more headroom for the same wall-clock pain). This subpath exists to preserve RFC 5054 interoperability rather than to offer a recommended choice.
|
||||
|
||||
The generator `g = 5` matches the 3072 and 4096-bit groups; only 8192 uses a different generator (`g = 19`). The choice was fixed at RFC-design time to produce a large prime-order subgroup of `Z_N*` — substituting any other generator would weaken the discrete-log hardness that backs SRP-6a's zero-knowledge property. Consumers building custom `SrpParams` from raw constants MUST use `g_6144` rather than hard-coding any other value.
|
||||
|
||||
Interactive login flows that select the 6144-bit group SHOULD schedule the handshake off the perceptual critical path — for example, in a Web Worker or as a deferred background promise — because the per-step wall time will dominate any concurrent rendering work. The benchmark suite includes 6144-bit numbers for capacity planning but the package default remains the 2048-bit group, which sits at the contemporary security floor while keeping a `modPow` cheap enough for an interactive login.
|
||||
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* RFC 5054 Appendix A — 6144-bit group `(N_6144, g_6144 = 5)`.
|
||||
*/
|
||||
|
||||
const N_6144_HEX =
|
||||
"FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74" +
|
||||
"020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F1437" +
|
||||
"4FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED" +
|
||||
"EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF05" +
|
||||
"98DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB" +
|
||||
"9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3B" +
|
||||
"E39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF695581718" +
|
||||
"3995497CEA956AE515D2261898FA051015728E5A8AAAC42DAD33170D04507A33" +
|
||||
"A85521ABDF1CBA64ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7" +
|
||||
"ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6BF12FFA06D98A0864" +
|
||||
"D87602733EC86A64521F2B18177B200CBBE117577A615D6C770988C0BAD946E2" +
|
||||
"08E24FA074E5AB3143DB5BFCE0FD108E4B82D120A92108011A723C12A787E6D7" +
|
||||
"88719A10BDBA5B2699C327186AF4E23C1A946834B6150BDA2583E9CA2AD44CE8" +
|
||||
"DBBBC2DB04DE8EF92E8EFC141FBECAA6287C59474E6BC05D99B2964FA090C3A2" +
|
||||
"233BA186515BE7ED1F612970CEE2D7AFB81BDD762170481CD0069127D5B05AA9" +
|
||||
"93B4EA988D8FDDC186FFB7DC90A6C08F4DF435C93402849236C3FAB4D27C7026" +
|
||||
"C1D4DCB2602646DEC9751E763DBA37BDF8FF9406AD9E530EE5DB382F413001AE" +
|
||||
"B06A53ED9027D831179727B0865A8918DA3EDBEBCF9B14ED44CE6CBACED4BB1B" +
|
||||
"DB7F1447E6CC254B332051512BD7AF426FB8F401378CD2BF5983CA01C64B92EC" +
|
||||
"F032EA15D1721D03F482D7CE6E74FEF6D55E702F46980C82B5A84031900B1C9E" +
|
||||
"59E7C97FBEC7E8F323A97A7E36CC88BE0F1D45B7FF585AC54BD407B22B4154AA" +
|
||||
"CC8F6D7EBF48E1D814CC5ED20F8037E0A79715EEF29BE32806A1D58BB7C5DA76" +
|
||||
"F550AA3D8A1FBFF0EB19CCB1A313D55CDA56C9EC2EF29632387FE8D76E3C0468" +
|
||||
"043E8F663F4860EE12BF2D5B0B7474D6E694F91E6DCC4024FFFFFFFFFFFFFFFF";
|
||||
|
||||
function hexToBytes(hex: string): Uint8Array {
|
||||
const out = new Uint8Array(hex.length / 2);
|
||||
for (let i = 0; i < out.length; i++) {
|
||||
out[i] = Number.parseInt(hex.substr(i * 2, 2), 16);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
export const N_6144: Uint8Array = hexToBytes(N_6144_HEX);
|
||||
export const g_6144: Uint8Array = new Uint8Array([5]);
|
||||
export const BIT_LENGTH = 6144;
|
||||
@@ -0,0 +1 @@
|
||||
export { BIT_LENGTH, g_6144, N_6144 } from "./groups-6144.js";
|
||||
Reference in New Issue
Block a user