Class Pbkdf2ParameterCalibrator
java.lang.Object
com.svenruppert.jsentinel.credential.password.pbkdf2.Pbkdf2ParameterCalibrator
- All Implemented Interfaces:
ParameterCalibrationService
Calibrates the PBKDF2-HMAC-SHA-256 iteration count for a target
verification runtime.
The calibrator scales iterations linearly: it picks a
starting iteration count, measures one hash, scales by the runtime
ratio, measures again, and stops once the runtime is within ±10%% of
the target or after a small cap on attempts. The result is the
CalibrationProfile the operator persists; production code
reloads the profile through CalibrationProfileStore
and never recalibrates on startup (CWE-754).
-
Constructor Summary
ConstructorsConstructorDescriptionPbkdf2ParameterCalibrator(Pbkdf2PasswordHashProvider provider, LongSupplier clockNanos, Clock wallClock, int startIterations, int keyLengthBytes) -
Method Summary
-
Constructor Details
-
Pbkdf2ParameterCalibrator
public Pbkdf2ParameterCalibrator() -
Pbkdf2ParameterCalibrator
public Pbkdf2ParameterCalibrator(Pbkdf2PasswordHashProvider provider, LongSupplier clockNanos, Clock wallClock, int startIterations, int keyLengthBytes)
-
-
Method Details
-
calibrate
- Specified by:
calibratein interfaceParameterCalibrationService- Parameters:
target- desired verification runtime (e.g. 250 ms)- Returns:
- calibrated profile whose parameters approximate the target within the implementation's tolerance
-