def sign(string, secret, algorithm = nil)
			plain = ::Base64.decode64(secret.gsub(/\.s$/,''))
			
			# if no override algorithm passed try and extract from string
			if algorithm.nil?
				paramMap = ::CGI.parse string

				if !paramMap.has_key?("algorithm")
					raise ArgumentError, "missing algorithm"
				end

				algorithm = paramMap["algorithm"].first.gsub(/^hmac/i,'')
			end
			
			hmac = ::OpenSSL::HMAC.digest(algorithm, plain, string)
			Base64::encode64(hmac).gsub(/\n$/,'')
		end
def sign(string, secret, algorithm = nil)
			plain = ::Base64.decode64(secret.gsub(/\.s$/,''))
			
			# if no override algorithm passed try and extract from string
			if algorithm.nil?
				paramMap = ::CGI.parse string

				if !paramMap.has_key?("algorithm")
					raise ArgumentError, "missing algorithm"
				end

				algorithm = paramMap["algorithm"].first.gsub(/^hmac/i,'')
			end
			
			hmac = ::OpenSSL::HMAC.digest(algorithm, plain, string)
			Base64::encode64(hmac).gsub(/\n$/,'')
		end
Sign a string with a secret

 Sign a string with a secret and get the signature

 * *Args*    :
   - +string+ -> the string to sign
   - +secret+ -> the secret to use
 * *Returns* :
   - the signature
 * *Raises* :
   - +ArgumentError+ -> if no algorithm passed and algorithm could not be derived from the string