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

org.bouncycastle.pqc.crypto.hawk

## Class HawkKeyPairGenerator

- java.lang.Object
- - org.bouncycastle.pqc.crypto.hawk.HawkKeyPairGenerator

- All Implemented Interfaces:
    AsymmetricCipherKeyPairGenerator

      public class HawkKeyPairGenerator
      extends java.lang.Object
      implements AsymmetricCipherKeyPairGenerator

  Lightweight Hawk key pair generator. Initialised with a `HawkKeyGenerationParameters` containing the parameter set and a `SecureRandom`; produces a `HawkPublicKeyParameters` / `HawkPrivateKeyParameters` pair.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `HawkKeyPairGenerator()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static int` | `encodePrivate(int logn, byte[] dst, int dstOffset, byte[] seed, int seedOffset, byte[] F, int fOffset, byte[] G, int gOffset, byte[] pub, int pubOffset, int pubLen)`
    `static boolean` | `encodePublic(int logn, byte[] dst, int dstOffset, int dstLen, short[] q00, int q00Offset, short[] q01, int q01Offset)`
    `static void` | `extractLowBit(int logn, byte[] dst, int dstOffset, byte[] f)`
    `AsymmetricCipherKeyPair` | `generateKeyPair()` return an AsymmetricCipherKeyPair containing the generated keys.
    `int` | `Hawk_keygen(int logn, byte[] f, int fOffset, byte[] g, int gOffset, byte[] F, int FOffset, byte[] G, int GOffset, short[] q00, int q00Offset, short[] q01, int q01Offset, int[] q11, int q11Offset, byte[] seed, int seedOffset, int[] tmp, int tmpOffset, int tmpLen)`
    `void` | `init(KeyGenerationParameters param)` intialise the key pair generator.

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

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

- - ### Constructor Detail

    - #### HawkKeyPairGenerator

          public HawkKeyPairGenerator()

  - ### Method Detail

    - #### init

          public void init(KeyGenerationParameters param)

      Description copied from interface: `AsymmetricCipherKeyPairGenerator`
      intialise the key pair generator.
      Specified by:
        `init` in interface `AsymmetricCipherKeyPairGenerator`
      Parameters:
        `param` - the parameters the key pair is to be initialised with.

    - #### generateKeyPair

          public AsymmetricCipherKeyPair generateKeyPair()

      Description copied from interface: `AsymmetricCipherKeyPairGenerator`
      return an AsymmetricCipherKeyPair containing the generated keys.
      Specified by:
        `generateKeyPair` in interface `AsymmetricCipherKeyPairGenerator`
      Returns:
        an AsymmetricCipherKeyPair containing the generated keys.

    - #### encodePublic

          public static boolean encodePublic(int logn,
                                             byte[] dst,
                                             int dstOffset,
                                             int dstLen,
                                             short[] q00,
                                             int q00Offset,
                                             short[] q01,
                                             int q01Offset)

    - #### extractLowBit

          public static void extractLowBit(int logn,
                                           byte[] dst,
                                           int dstOffset,
                                           byte[] f)

    - #### Hawk_keygen

          public int Hawk_keygen(int logn,
                                 byte[] f,
                                 int fOffset,
                                 byte[] g,
                                 int gOffset,
                                 byte[] F,
                                 int FOffset,
                                 byte[] G,
                                 int GOffset,
                                 short[] q00,
                                 int q00Offset,
                                 short[] q01,
                                 int q01Offset,
                                 int[] q11,
                                 int q11Offset,
                                 byte[] seed,
                                 int seedOffset,
                                 int[] tmp,
                                 int tmpOffset,
                                 int tmpLen)

    - #### encodePrivate

          public static int encodePrivate(int logn,
                                          byte[] dst,
                                          int dstOffset,
                                          byte[] seed,
                                          int seedOffset,
                                          byte[] F,
                                          int fOffset,
                                          byte[] G,
                                          int gOffset,
                                          byte[] pub,
                                          int pubOffset,
                                          int pubLen)