def sign(params)
      RubyDesk.logger.debug {"Params to sign: #{params.inspect}"}
      # sort parameters by its names (keys)
      sorted_params = params.sort { |a, b| a.to_s <=> b.to_s}

      RubyDesk.logger.debug {"Sorted params: #{sorted_params.inspect}"}
      
      # Unescape escaped params
      sorted_params.map! do |k, v|
        [k, URI.unescape(v)]
      end

      # concatenate secret with names, values
      concatenated = @api_secret + sorted_params.join

      RubyDesk.logger.debug {"concatenated: #{concatenated}"}

      # Calculate and return md5 of concatenated string
      md5 = Digest::MD5.hexdigest(concatenated)

      RubyDesk.logger.debug {"md5: #{md5}"}

      return md5
    end
def sign(params)
      RubyDesk.logger.debug {"Params to sign: #{params.inspect}"}
      # sort parameters by its names (keys)
      sorted_params = params.sort { |a, b| a.to_s <=> b.to_s}

      RubyDesk.logger.debug {"Sorted params: #{sorted_params.inspect}"}
      
      # Unescape escaped params
      sorted_params.map! do |k, v|
        [k, URI.unescape(v)]
      end

      # concatenate secret with names, values
      concatenated = @api_secret + sorted_params.join

      RubyDesk.logger.debug {"concatenated: #{concatenated}"}

      # Calculate and return md5 of concatenated string
      md5 = Digest::MD5.hexdigest(concatenated)

      RubyDesk.logger.debug {"md5: #{md5}"}

      return md5
    end
Sign the given parameters and returns the signature