java.lang.Object
org.cryptomator.cryptolib.common.Scrypt
-
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]scrypt(byte[] passphrase, byte[] salt, int costParam, int blockSize, int keyLengthInBytes) Derives a key from the given passphrase.static byte[]scrypt(CharSequence passphrase, byte[] salt, int costParam, int blockSize, int keyLengthInBytes) Derives a key from the given passphrase.
-
Method Details
-
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 generatedcostParam- Cost parameterN, larger than 1, a power of 2 and less than2^(128 * blockSize / 8)blockSize- Block sizerkeyLengthInBytes- Key output lengthdkLen- Returns:
- Derived key
- See Also:
-
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 generatedcostParam- Cost parameterN, larger than 1, a power of 2 and less than2^(128 * blockSize / 8)blockSize- Block sizerkeyLengthInBytes- Key output lengthdkLen- Returns:
- Derived key
- See Also:
-