Class Scrypt


  • public class Scrypt
    extends Object
    • Method Detail

      • scrypt

        public static byte[] scrypt​(CharSequence passphrase,
                                    byte[] salt,
                                    int costParam,
                                    int blockSize,
                                    int keyLengthInBytes)
        Derives a key from the given passphrase. This implementation makes sure, any copies of the passphrase used during key derivation are overwritten in memory asap (before next GC cycle).
        Parameters:
        passphrase - The passphrase, whose characters will get UTF-8 encoded during key derivation.
        salt - Salt, ideally randomly generated
        costParam - Cost parameter N, larger than 1, a power of 2 and less than 2^(128 * blockSize / 8)
        blockSize - Block size r
        keyLengthInBytes - Key output length dkLen
        Returns:
        Derived key
        See Also:
        RFC 7914
      • scrypt

        public static byte[] scrypt​(byte[] passphrase,
                                    byte[] salt,
                                    int costParam,
                                    int blockSize,
                                    int keyLengthInBytes)
        Derives a key from the given passphrase. This implementation makes sure, any copies of the passphrase used during key derivation are overwritten in memory asap (before next GC cycle).
        Parameters:
        passphrase - The passphrase,
        salt - Salt, ideally randomly generated
        costParam - Cost parameter N, larger than 1, a power of 2 and less than 2^(128 * blockSize / 8)
        blockSize - Block size r
        keyLengthInBytes - Key output length dkLen
        Returns:
        Derived key
        See Also:
        RFC 7914