Skip to content

Costfactor tuning for SCRYPT Key Derivation

Peter Hyman edited this page Feb 6, 2025 · 1 revision

Cost factor for Key Derivation Function determines the number of hashings a key will undergo. Cost factor is expressed as a power of 2 between 2^10 (1Kb) and 2^40 (1Tb). The higher the cost factor, the more memory required. Memory requirements are 1024 * CF.

Cost factor is normally computed as RAM/2/1024 rounded down to a power of 2.

Example

16GB system / 2 = 8GB
8GB / 1024 = 8MB which would be expressed as 2^23

On smaller systems, a bug was found #165 where cost factor was set higher than possible. Also, this bug would prohibit a smaller system from decrypting a file made on a larger system since the CF used for hashing would require more memory than possible. In this small case, a smaller cost factor can be set to override that which is computed.

--costfactor=10 would set a 1KB cost factor.