NTRUHPSParameterSet (Bouncy Castle Library 1.85 API Specification)
Date: 2026-07-12

org.bouncycastle.pqc.math.ntru.parameters

## Class NTRUHPSParameterSet

- java.lang.Object
- - org.bouncycastle.pqc.math.ntru.parameters.NTRUParameterSet
  - - org.bouncycastle.pqc.math.ntru.parameters.NTRUHPSParameterSet

- Direct Known Subclasses:
    NTRUHPS2048509, NTRUHPS2048677, NTRUHPS40961229, NTRUHPS4096821

      public abstract class NTRUHPSParameterSet
      extends NTRUParameterSet

  Abstract class for NTRU-HPS parameter classes.

  The naming convention for the classes is `NTRUHPS[q][n]`. e.g. `NTRUHPS2048509` has n = 509 and q = 2048.

  See Also:
    `NTRUHPS2048509`, `NTRUHPS2048677`, `NTRUHPS4096821`, NTRU specification document section 1.3.2

- - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Polynomial` | `createPolynomial()` Creates a polynomial based on this parameter set.
    `int` | `sampleFgBytes()`
    `int` | `sampleRmBytes()`
    `int` | `weight()`

    - ### Methods inherited from class org.bouncycastle.pqc.math.ntru.parameters.NTRUParameterSet

      `logQ, n, ntruCiphertextBytes, ntruPublicKeyBytes, ntruSecretKeyBytes, owcpaBytes, owcpaMsgBytes, owcpaPublicKeyBytes, owcpaSecretKeyBytes, packDegree, packTrinaryBytes, prfKeyBytes, q, sampleFixedTypeBytes, sampleIidBytes, seedBytes, sharedKeyBytes`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### createPolynomial

          public Polynomial createPolynomial()

      Description copied from class: `NTRUParameterSet`
      Creates a polynomial based on this parameter set.
      Specified by:
        `createPolynomial` in class `NTRUParameterSet`
      Returns:
        an instance of `Polynomial`

    - #### sampleFgBytes

          public int sampleFgBytes()

      Specified by:
        `sampleFgBytes` in class `NTRUParameterSet`
      Returns:
        `sample_key_bits/8`

    - #### sampleRmBytes

          public int sampleRmBytes()

      Specified by:
        `sampleRmBytes` in class `NTRUParameterSet`
      Returns:
        `sample_plaintext_bits/8`

    - #### weight

          public int weight()