def calc_cred(method, uri, user, passwd, param)
    a_1 = "#{user}:#{param['realm']}:#{passwd}"
    a_2 = "#{method}:#{uri.path}"
    @nonce_count += 1
    message_digest = []
    message_digest << Digest::MD5.hexdigest(a_1)
    message_digest << param['nonce']
    message_digest << ('%08x' % @nonce_count)
    message_digest << param['nonce']
    message_digest << param['qop']
    message_digest << Digest::MD5.hexdigest(a_2)
    header = []
    header << "username=\"#{user}\""
    header << "realm=\"#{param['realm']}\""
    header << "nonce=\"#{param['nonce']}\""
    header << "uri=\"#{uri.path}\""
    header << "cnonce=\"#{param['nonce']}\""
    header << "nc=#{'%08x' % @nonce_count}"
    header << "qop=\"#{param['qop']}\""
    header << "response=\"#{Digest::MD5.hexdigest(message_digest.join(":"))}\""
    header << "algorithm=\"MD5\""
    header << "opaque=\"#{param['opaque']}\"" if param.key?('opaque')
    header.join(", ")
  end
def calc_cred(method, uri, user, passwd, param)
    a_1 = "#{user}:#{param['realm']}:#{passwd}"
    a_2 = "#{method}:#{uri.path}"
    @nonce_count += 1
    message_digest = []
    message_digest << Digest::MD5.hexdigest(a_1)
    message_digest << param['nonce']
    message_digest << ('%08x' % @nonce_count)
    message_digest << param['nonce']
    message_digest << param['qop']
    message_digest << Digest::MD5.hexdigest(a_2)
    header = []
    header << "username=\"#{user}\""
    header << "realm=\"#{param['realm']}\""
    header << "nonce=\"#{param['nonce']}\""
    header << "uri=\"#{uri.path}\""
    header << "cnonce=\"#{param['nonce']}\""
    header << "nc=#{'%08x' % @nonce_count}"
    header << "qop=\"#{param['qop']}\""
    header << "response=\"#{Digest::MD5.hexdigest(message_digest.join(":"))}\""
    header << "algorithm=\"MD5\""
    header << "opaque=\"#{param['opaque']}\"" if param.key?('opaque')
    header.join(", ")
  end
this method is implemented by sromano and posted to
 http://tools.assembla.com/breakout/wiki/DigestForSoap
 Thanks!
 supported algorithm: MD5 only for now