lib/rbnacl/util.rb
def check_string(string, length, description)
      check_string_validation(string)
      string = string.to_s
      check_length(string, length, description)

      string
    end
def check_string(string, length, description)
      check_string_validation(string)
      string = string.to_s
      check_length(string, length, description)

      string
    end
Check a passed in string, converting the argument if necessary

 In several places through the codebase we have to be VERY strict with
 the strings we accept.  This method supports that.

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

 @param string [#to_str] The input string
 @param length [Integer] The only acceptable length of the string
 @param description [String] Description of the string (used in the error)