Skip to content
  • Milan Broz's avatar
    Add Argon2 benchmark code. · 8a859391
    Milan Broz authored
    
    
    Code based on patch by Ondrej Mosnacek
    
    The new benchmark works as follows:
    
    Phase 1:
    It searches for smallest parameters, such that the duration is 250 ms
    (this part is quite fast).
    Then it uses that data point to estimate the paramters that will have
    the desired duration (and fulfill the basic constraints).
    
    Phase 2:
    The candidate parameters are then measured and if their duration falls
    within +-5% of the target duration, they are accepted.
    Otherwise, new candidate parameters are estimated based on the last
    measurement and phase 2 is repeated.
    
    When measuring the duration for given parameters, the measurement
    is repeated 3 or 4 times and a minimum of the measured durations
    is used as the final duration (to reduce variance in measurements).
    A minimum is taken instead of mean, because the measurements definitely
    have a certain lower bound, but no upper bound (therefore mean value
    would tend to be higher than the value with highest probability density).
    The actual "most likely" duration is going to be somewhere just above
    the minimum measurable value, so minimum over the observations is
    a better estimate than mean.
    
    Signed-off-by: default avatarMilan Broz <gmazyland@gmail.com>
    8a859391