class RbNaCl::PasswordHash::Argon2

def self.opslimit_value(opslimit)

Returns:
  • (Integer) - opslimit a valid value for opslimit

Raises:
  • (ArgumentError) - if the value is out of range

Parameters:
  • opslimit (Integer) -- value to be checked
def self.opslimit_value(opslimit)
  case opslimit
  when :interactive then OPSLIMIT_INTERACTIVE
  when :moderate then OPSLIMIT_MODERATE
  when :sensitive then OPSLIMIT_SENSITIVE
  when OPSLIMIT_MIN..OPSLIMIT_MAX then opslimit.to_i
  else
    raise ArgumentError, "opslimit must be within the range 3..10"
  end
end