lib/rbnacl/util.rb
def check_hmac_key(string, _description)
      check_string_validation(string)

      string = string.to_str

      if string.bytesize.zero?
        raise LengthError,
              "#{Description} was #{string.bytesize} bytes (Expected more than 0)",
              caller
      end

      string
    end
def check_hmac_key(string, _description)
      check_string_validation(string)

      string = string.to_str

      if string.bytesize.zero?
        raise LengthError,
              "#{Description} was #{string.bytesize} bytes (Expected more than 0)",
              caller
      end

      string
    end
Check a passed in string, convertion if necessary

 This method will check the key, and raise error
 if argument is not a string, and if it's empty string.

 RFC 2104 HMAC
 The key for HMAC can be of any length (keys longer than B bytes are
 first hashed using H). However, less than L bytes is strongly
 discouraged as it would decrease the security strength of the
 function.  Keys longer than L bytes are acceptable but the extra
 length would not significantly increase the function strength. (A
 longer key may be advisable if the randomness of the key is
 considered weak.)

 see https://tools.ietf.org/html/rfc2104#section-3


 @raise [ArgumentError] If we cannot convert to a string with #to_str
 @raise [RbNaCl::LengthError] If the string is empty

 @param string [#to_str] The input string