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

org.bouncycastle.crypto.generators

## Class SCrypt

- java.lang.Object
- - org.bouncycastle.crypto.generators.SCrypt

-     public class SCrypt
      extends java.lang.Object

  Implementation of the scrypt a password-based key derivation function.

  Scrypt was created by Colin Percival and is specified in RFC 7914 - The scrypt Password-Based Key Derivation Function

- - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static byte[]` | `generate(byte[] P, byte[] S, int N, int r, int p, int dkLen)` Generate a key using the scrypt key derivation function.

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

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

- - ### Method Detail

    - #### generate

          public static byte[] generate(byte[] P,
                                        byte[] S,
                                        int N,
                                        int r,
                                        int p,
                                        int dkLen)

      Generate a key using the scrypt key derivation function.
      Parameters:
        `P` - the bytes of the pass phrase.
        `S` - the salt to use for this invocation.
        `N` - CPU/Memory cost parameter. Must be larger than 1, a power of 2 and less than `2^(128 * r / 8)`.
        `r` - the block size, must be >= 1.
        `p` - Parallelization parameter. Must be a positive integer less than or equal to `Integer.MAX_VALUE / (128 * r * 8)`.
        `dkLen` - the length of the key to generate.
      Returns:
        the generated key.