ComplexityLimit

public enum ComplexityLimit

Defines how much CPU load will be required for hashing a password. This reduces the speed of brute-force attacks. You might be required to chose high or medium if your device does not have much CPU power.

  • This is the fastest option and should be avoided if possible.

    Declaration

    Swift

    case medium
  • This takes about 0.7 seconds on a 2.8 Ghz Core i7 CPU.

    Declaration

    Swift

    case high
  • This takes about 3.5 seconds on a 2.8 Ghz Core i7 CPU.

    Declaration

    Swift

    case veryHigh
  • Helper function to translate the ComplexityLimit enum to the values expected by libsodium.

    Declaration

    Swift

    fileprivate var sodiumValue: Int { get }

    Return Value

    The complexity limit that can be interpreted by libsodium.

  • Translates a given value from libsodium to a corresponding enum value.

    Declaration

    Swift

    fileprivate init?(value: Int)

    Parameters

    value

    The complexity limit that can be interpreted by libsodium.