• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python md5.new函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中md5.new函数的典型用法代码示例。如果您正苦于以下问题:Python new函数的具体用法?Python new怎么用?Python new使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了new函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: auth_flickr

def auth_flickr(request):
    from agro.sources import utils
    api, secret, url = 'e22dd4a81125531e047036ed1ab2a9e7', '72a484d250375bdf', ''
    token = ''
    user_name, user_id = '', ''

    frob = request.GET.get('frob', '')

    if frob:
        api_sig = md5.new('%sapi_key%sfrob%smethodflickr.auth.getToken' % (secret, api, frob)).hexdigest()
        params = urllib.urlencode({'api_key':api, 'frob':frob, 'method':'flickr.auth.getToken', 'api_sig':api_sig})
        res = utils.get_remote_data("http://api.flickr.com/services/rest/?" + params)

        if res.get("stat", "") == "fail":
            log.error("flickr retrieve failed.")
            log.error("%s" % res.get("stat"))
            return False

        #token = res.get('auth')
        auth_res = res.getchildren()[0]
        token = auth_res.find('token').text
        user = auth_res.find('user')
        user_name = user.get('username')
        user_id = user.get('nsid')

    else:
        if request.method == 'POST':
            perms = 'read'
            api_sig = md5.new('%sapi_key%sperms%s' % (secret, api, perms)).hexdigest()
            params = urllib.urlencode({'api_key':api, 'perms':perms, 'api_sig':api_sig})
            return HttpResponseRedirect('http://flickr.com/services/auth/?%s' % params)
        else:
            pass

    return render_to_response('flickr_auth.html', {'api':api, 'secret':secret, 'user_name':user_name, 'user_id':user_id, 'token':token,}, context_instance=RequestContext(request))
开发者ID:blturner,项目名称:agro,代码行数:35,代码来源:auth_views.py


示例2: _unzipIterChunkyTest

    def _unzipIterChunkyTest(self, compression, chunksize, lower, upper):
        """
        unzipIterChunky should unzip the given number of bytes per iteration.
        """
        junk = ' '.join([str(random.random()) for n in xrange(1000)])
        junkmd5 = md5.new(junk).hexdigest()

        tempdir = filepath.FilePath(self.mktemp())
        tempdir.makedirs()
        zfpath = tempdir.child('bigfile.zip').path
        self._makebigfile(zfpath, compression, junk)
        uziter = zipstream.unzipIterChunky(zfpath, tempdir.path,
                                           chunksize=chunksize)
        r = uziter.next()
        # test that the number of chunks is in the right ballpark;
        # this could theoretically be any number but statistically it
        # should always be in this range
        approx = lower < r < upper
        self.failUnless(approx)
        for r in uziter:
            pass
        self.assertEqual(r, 0)
        newmd5 = md5.new(
            tempdir.child("zipstreamjunk").open().read()).hexdigest()
        self.assertEqual(newmd5, junkmd5)
开发者ID:AnthonyNystrom,项目名称:YoGoMee,代码行数:25,代码来源:test_zipstream.py


示例3: update_feeds

def update_feeds():
    context = Context.objects.get(pk=1)
    feeds = Feed.objects.filter(enabled=True)
    for f in feeds:
        try:
            print "Starting %s..." % (f.title)
            stream = feedparser.parse(f.url)
            for e in stream['entries']:
                try:
                    print "Getting entry id %s" % (e.id)
                    if Item.objects.filter(md5sum=md5.new(e.link).hexdigest()).count() > 0:
                        print 'Skipping duplicate item'
                    else:
                        e_date = e.updated_parsed
                        if not e_date:
                            e_date = datetime.datetime.utcnow()
                        if hasattr(e, "summary"):
                            e_content = e.summary.encode('ascii', 'xmlcharrefreplace')
                        elif hasattr(e, "content"):
                            e_content = e.content[0].value.encode('ascii', 'xmlcharrefreplace')
                        i = Item(feed = f,
                                 md5sum = md5.new(e.link).hexdigest(),
                                 guid = e.id,
                                 title = e.title.encode('ascii', 'xmlcharrefreplace'),
                                 link = e.link,
                                 date = datetime.datetime.utcfromtimestamp(calendar.timegm(e_date)),
                                 content = e_content,
                                 context = context,
                                )
                        i.save()
                        print "%s - %s - Added!" % (f.title, i.title)
                except Exception, e:
                    print e
        except Exception, e:
            print e
开发者ID:doubtingben,项目名称:rssbot,代码行数:35,代码来源:feeds.py


示例4: find_hotels

def find_hotels(city, country, state):
	service = "http://api.ean.com/ean-services/rs/hotel/"
	version = "v3/"
	method = "list"
	other_elements = "&cid=YOUR ACCOUNT NUMBER HERE&customerIpAddress=50.148.140.1&customerUserAgent=OSX10.9.5&customerSessionId=123456&minorRev=30&locale=en_US&currencyCode=USD"
	response_type = "json"
	API_KEY = "YOUR API KEY HERE"
	API_secret= "YOUR API SECRET HERE"
	hash = md5.new()
	timestamp = str(int(time.time()))
	signature = md5.new(API_KEY + API_secret + timestamp).hexdigest()
	city = "%s" % (city)
	countryCode = "%s" % (country)
	state = "%s" % (state)

	print '\n------------------------------\nCheck out this list of hotel suggestions\n------------------------------'
	hotel_url = service + version + method + '?apiKey=' + API_KEY + '&sig=' + signature + '&_type=' + response_type + other_elements + '&city=' + city + '&countryCode=' + countryCode + '&stateProvinceCode=' + state 
	response = urlopen(hotel_url)
	json_response = load(response)
	firstSix = json_response['HotelListResponse']['HotelList']['HotelSummary'][0:6]

	for hotels in firstSix:
		print "\nHotel Name: ", hotels["name"]
		print "Address: ", hotels["address1"]
		print "Rating: ", hotels["hotelRating"]
		print "Location: ", hotels["locationDescription"]
	exit()
开发者ID:katietarng,项目名称:hb-intro-final-project,代码行数:27,代码来源:final_project.py


示例5: PwCrypt

    def PwCrypt(self, password):
        """Obfuscate password
		
		RADIUS hides passwords in packets by using an algorithm
		based on the MD5 hash of the pacaket authenticator and RADIUS
		secret. If no authenticator has been set before calling PwCrypt
		one is created automatically. Changing the authenticator after
		setting a password that has been encrypted using this function
		will not work.

		@param password: plaintext password
		@type password:  string
		@return:         obfuscated version of the password
		@rtype:          string
		"""
        if self.authenticator == None:
            self.authenticator = self.CreateAuthenticator()

        buf = password
        if len(password) % 16 != 0:
            buf += "\x00" * (16 - (len(password) % 16))

        hash = md5.new(self.secret + self.authenticator).digest()
        result = ""

        last = self.authenticator
        while buf:
            hash = md5.new(self.secret + last).digest()
            for i in range(16):
                result += chr(ord(hash[i]) ^ ord(buf[i]))

            last = result[-16:]
            buf = buf[16:]

        return result
开发者ID:zeroleo12345,项目名称:freeIBS,代码行数:35,代码来源:packet.py


示例6: continuity

def continuity(url):
    import md5
    format = '%25s: %s'

    # first fetch the file with the normal http handler
    opener = urllib2.build_opener()
    urllib2.install_opener(opener)
    fo = urllib2.urlopen(url)
    foo = fo.read()
    fo.close()
    m = md5.new(foo)
    print format % ('normal urllib', m.hexdigest())

    # now install the keepalive handler and try again
    opener = urllib2.build_opener(HTTPHandler())
    urllib2.install_opener(opener)

    fo = urllib2.urlopen(url)
    foo = fo.read()
    fo.close()
    m = md5.new(foo)
    print format % ('keepalive read', m.hexdigest())

    fo = urllib2.urlopen(url)
    foo = ''
    while 1:
        f = fo.readline()
        if f: foo = foo + f
        else: break
    fo.close()
    m = md5.new(foo)
    print format % ('keepalive readline', m.hexdigest())
开发者ID:intech,项目名称:sqlmap,代码行数:32,代码来源:keepalive.py


示例7: api

    def api(self, site, method_name, GET={}, POST={}):
        if site == 'vk.com':
            GET['access_token'] = self.app_data[site]['access_token']
            GET = urllib.urlencode(GET)
            POST = urllib.urlencode(POST)
            url = oauth_data[site]['url_api']
            query = oauth_data[site]['query'] + method_name +'?'+ urllib.urlencode(self.settings_api) +'&'+ GET
            if POST != '': _POST = '&'+POST
            else: _POST = ''
            if acceessPermission[site]['nohttps']:
                sig = '&sig='+md5.new(query+_POST+self.app_data[site]['secret']).hexdigest()
            else: sig = ''
            res = self.openers[site].open(url+query+sig, POST) 
        elif site == 'ok.ru': 
            GET['application_key'] = self.user_data[site][3]
            GET['method'] = method_name
            keys = GET.keys()
            keys.sort()
            sig = ''
            for key in keys:
                sig += key +'='+ str(GET[key])
            sig = md5.new(sig+self.app_data[site]['session_secret_key']).hexdigest().lower()

            GET['access_token'] = self.app_data[site]['access_token']
            GET['sig'] = sig

            if self.app_data[site].has_key('api_server'): url = self.app_data[site]['api_server']
            else: url = oauth_data[site]['url_api']
            res = self.openers[site].open(url + oauth_data[site]['query'] + urllib.urlencode(GET))
        elif site == 'disk.yandex.ru': pass
        
        return self._process_response(res, site)
开发者ID:Ra93POL,项目名称:VKAPI,代码行数:32,代码来源:VKAPI.py


示例8: post

    def post(self):

        ip = self.request.get('ip')
        service = 'http://api.quova.com/'
        version = 'v1/'
        method = 'ipinfo/'
        apikey = '100.tkdykh8mvt7uut8ychhv'
        secret = 'Pd3c9pzT'
        
        hash = md5.new()
        timestamp = str(int(time.time()))
        sig = md5.new(apikey + secret + timestamp).hexdigest()
        url = service + version + method + ip + '?apikey=' + apikey + '&sig=' + sig + '&format=xml'
        xml = urllib2.urlopen(url).read()
        
        doc = parseString(xml)

        ip_address = doc.getElementsByTagName('ip_address')[0].firstChild.nodeValue
        organization = doc.getElementsByTagName('organization')[0].firstChild.nodeValue
        carrier = doc.getElementsByTagName('carrier')[0].firstChild.nodeValue
        sld = doc.getElementsByTagName('sld')[0].firstChild.nodeValue
        country = doc.getElementsByTagName('country')[0].firstChild.nodeValue
        state = doc.getElementsByTagName('state')[0].firstChild.nodeValue
        city = doc.getElementsByTagName('city')[0].firstChild.nodeValue
        postal_code = doc.getElementsByTagName('postal_code')[0].firstChild.nodeValue
        lat = doc.getElementsByTagName('latitude')[0].firstChild.nodeValue
        lon = doc.getElementsByTagName('longitude')[0].firstChild.nodeValue

        g = PyMap()
        g.key = "ABQIAAAAGcWIjwYvD9qHwmbKuSQEsxQ_LYszwfeN3sChNNHex23LZKwkgRTB3_7Qo5_EhYBGijp8h1khiBFjkg"
        g.maps[0].zoom = 12
        s = [lat,lon, ip_address+'<br>'+organization+'<br>'+carrier+'<br>'+sld+'<br>'+country+'<br>'+state+'<br>'+city+'<br>'+postal_code+'<br>'+lat+'<br>'+lon]
        g.maps[0].setpoint(s)
	g.maps[0].center = (lat,lon)
        self.response.out.write(g.showhtml())
开发者ID:paulononaka,项目名称:python_location_by_ip,代码行数:35,代码来源:main.py


示例9: _pkt_R

    def _pkt_R(self):
        #
        # Startup Response
        #
        code = _unpack('!i', self.__read_bytes(4))[0]
        if code == 0:
            self.__authenticated = 1
            #print 'Authenticated!'
        elif code == 1:
            raise InterfaceError('Kerberos V4 authentication is required by server, but not supported by this client')
        elif code == 2:
            raise InterfaceError('Kerberos V5 authentication is required by server, but not supported by this client')
        elif code == 3:
            self.__send(_pack('!i', len(self.__passwd)+5) + self.__passwd + '\0')
        elif code == 4:
            salt = self.__read_bytes(2)
            try:
                import crypt
            except:
                raise InterfaceError('Encrypted authentication is required by server, but Python crypt module not available')
            cpwd = crypt.crypt(self.__passwd, salt)
            self.__send(_pack('!i', len(cpwd)+5) + cpwd + '\0')
        elif code == 5:
            import md5

            m = md5.new(self.__passwd + self.__userid).hexdigest()
            m = md5.new(m + self.__read_bytes(4)).hexdigest()
            m = 'md5' + m + '\0'
            self.__send(_pack('!i', len(m)+4) + m)
        else:
            raise InterfaceError('Unknown startup response code: R%d (unknown password encryption?)' % code)
开发者ID:seanjensengrey,项目名称:bpgsql,代码行数:31,代码来源:bpgsql.py


示例10: mkpasswd

def mkpasswd(pwd,hash='ssha'):
    """Generate hashed passwords. Originated from mkpasswd in Luma
    """
    alg = {
        'ssha':'Seeded SHA-1',
        'sha':'Secure Hash Algorithm',
        'smd5':'Seeded MD5',
        'md5':'MD5',
        'crypt':'Standard unix crypt'
    }
    # Don't add support for sambapasswords unless we're using it
    if (update_sambapassword):
        alg['lmhash'] = 'Lanman hash'
        alg['nthash'] = 'NT Hash'
    if hash not in alg.keys():
        return "Algorithm <%s> not supported in this version." % hash
    else:
        salt = getsalt()
        if hash == "ssha":
            return "{SSHA}" + base64.encodestring(sha.new(str(pwd) + salt).digest() + salt)
        elif hash == "sha":
            return "{SHA}" + base64.encodestring(sha.new(str(pwd)).digest())
        elif hash == "md5":
            return "{SHA}" + base64.encodestring(md5.new(str(pwd)).digest())
        elif hash == "smd5":
            return "{SMD%}" + base64.encodestring(md5.new(str(pwd) + salt).digest() + salt)
        elif hash == "crypt":
            return "{CRYPT}" + crypt.crypt(str(pwd),getsalt(length=2))
        # nt/lm-hash are used directly in their own password-attributes.. no need to prefix the hash
        elif hash == "lmhash":
            return smbpasswd.lmhash(pwd)
        elif hash == "nthash":
            return smbpasswd.nthash(pwd)
开发者ID:tivalat,项目名称:OpenLDAP,代码行数:33,代码来源:grotan.py


示例11: __init__

	def __init__(self, *args, **kwargs):
		super(UserFile, self).__init__(*args, **kwargs)
		self.errors = []
		self.errors_es = []
		obj_list = {}
		for line in self.xml_text.split('\n'):
			num = self.xml_text.split('\n').index(line) + 1
			if ('<map' in line):
				obj = MapElement(line, num)
				md5_obj = md5.new()
				md5_obj.update(obj.element_name)
				obj_hash = md5_obj.hexdigest()
				if obj_hash in obj_list.keys():
					pass
				obj_list[obj_hash] = obj
				for item in obj.err_list:
					self.errors.append(item)
				for item in obj.err_list_es:
					self.errors_es.append(item)
			else:
				obj = XMLElement(line, num)
				md5_obj = md5.new()
				md5_obj.update(obj.element_name)
				obj_hash = md5_obj.hexdigest()
				obj_list[obj_hash] = obj
				for item in obj.err_list:
					self.errors.append(item)
				for item in obj.err_list_es:
					self.errors_es.append(item)
开发者ID:TheMetaphorer,项目名称:OCN-XMLChecker,代码行数:29,代码来源:models.py


示例12: test_eventteams_update

    def test_eventteams_update(self):
        self.teams_auth.put()

        team_list = ['frc254', 'frc971', 'frc604']
        request_body = json.dumps(team_list)

        request_path = '/api/trusted/v1/event/2014casj/team_list/update'
        sig = md5.new('{}{}{}'.format('321tEsTsEcReT', request_path, request_body)).hexdigest()
        response = self.testapp.post(request_path, request_body, headers={'X-TBA-Auth-Id': 'tEsT_id_0', 'X-TBA-Auth-Sig': sig}, expect_errors=True)

        self.assertEqual(response.status_code, 200)

        db_eventteams = EventTeam.query(EventTeam.event == self.event.key).fetch(None)
        self.assertEqual(len(db_eventteams), 3)
        self.assertTrue('2014casj_frc254' in [et.key.id() for et in db_eventteams])
        self.assertTrue('2014casj_frc971' in [et.key.id() for et in db_eventteams])
        self.assertTrue('2014casj_frc604' in [et.key.id() for et in db_eventteams])

        team_list = ['frc254', 'frc100']
        request_body = json.dumps(team_list)

        sig = md5.new('{}{}{}'.format('321tEsTsEcReT', request_path, request_body)).hexdigest()
        response = self.testapp.post(request_path, request_body, headers={'X-TBA-Auth-Id': 'tEsT_id_0', 'X-TBA-Auth-Sig': sig}, expect_errors=True)

        self.assertEqual(response.status_code, 200)

        db_eventteams = EventTeam.query(EventTeam.event == self.event.key).fetch(None)
        self.assertEqual(len(db_eventteams), 2)
        self.assertTrue('2014casj_frc254' in [et.key.id() for et in db_eventteams])
        self.assertTrue('2014casj_frc100' in [et.key.id() for et in db_eventteams])
开发者ID:BowlesCR,项目名称:the-blue-alliance,代码行数:30,代码来源:test_api_trusted.py


示例13: test_awards_update

    def test_awards_update(self):
        self.awards_auth.put()

        awards = [{'name_str': 'Winner', 'team_key': 'frc254'},
                  {'name_str': 'Winner', 'team_key': 'frc604'},
                  {'name_str': 'Volunteer Blahblah', 'team_key': 'frc1', 'awardee': 'Bob Bobby'}]
        request_body = json.dumps(awards)

        request_path = '/api/trusted/v1/event/2014casj/awards/update'
        sig = md5.new('{}{}{}'.format('321tEsTsEcReT', request_path, request_body)).hexdigest()
        response = self.testapp.post(request_path, request_body, headers={'X-TBA-Auth-Id': 'tEsT_id_4', 'X-TBA-Auth-Sig': sig}, expect_errors=True)

        self.assertEqual(response.status_code, 200)

        db_awards = Award.query(Award.event == self.event.key).fetch(None)
        self.assertEqual(len(db_awards), 2)
        self.assertTrue('2014casj_1' in [a.key.id() for a in db_awards])
        self.assertTrue('2014casj_5' in [a.key.id() for a in db_awards])

        awards = [{'name_str': 'Winner', 'team_key': 'frc254'},
                  {'name_str': 'Winner', 'team_key': 'frc604'}]
        request_body = json.dumps(awards)

        sig = md5.new('{}{}{}'.format('321tEsTsEcReT', request_path, request_body)).hexdigest()
        response = self.testapp.post(request_path, request_body, headers={'X-TBA-Auth-Id': 'tEsT_id_4', 'X-TBA-Auth-Sig': sig}, expect_errors=True)

        self.assertEqual(response.status_code, 200)

        db_awards = Award.query(Award.event == self.event.key).fetch(None)
        self.assertEqual(len(db_awards), 1)
        self.assertTrue('2014casj_1' in [a.key.id() for a in db_awards])
开发者ID:BowlesCR,项目名称:the-blue-alliance,代码行数:31,代码来源:test_api_trusted.py


示例14: info

def info(model, msg):
    print '**** %s ****' % msg
    print 'md5(Wv) = ', md5.new(model.Wv.get_value()).hexdigest()
    print 'rstate = ', model.theano_rng.rstate
    print 'state_updates:'
    for s in model.theano_rng.state_updates:
        print '\t', md5.new(s[0].get_value()).hexdigest()
开发者ID:codeaudit,项目名称:ssrbm,代码行数:7,代码来源:test_reload2.py


示例15: change_password

def change_password(request, data, user):
    '''
    API to change password
    :param request:
    :param data:
    :param user:
    '''
    try:

        user_id = user.id
        old_password = data['old_password'].strip()
        new_password = data['new_password'].strip()

        if md5.new(old_password).hexdigest() != user.password:
            return custom_error(
                "The current password you have entered is incorrect.")

        user.password = md5.new(new_password).hexdigest()
        user.password_reset = False
        user.save()

        log.info("user : " + user.email + " : changed password")
        return json_response({"status": 1,
                              "message": "Password changed successfully."})
    except Exception as error:
        log.error("Change password failed : " + error.message)
        return custom_error("Failed to change the password.")
开发者ID:nevinm,项目名称:Hotel-website,代码行数:27,代码来源:common.py


示例16: hash_file

def hash_file(FILE_NAME):
    '''
    Description:  This function will hash a file and return the hash object.
    The hash algorithm can be modified by changing the hashlib algorithm.
    This function should be able to hash objects of indefinite size.  

    References:
    https://docs.python.org/2/library/hashlib.html
    http://www.pythoncentral.io/hashing-files-with-python/

    input args:
    FILE_NAME is the path and name of the file to be hashed in string format.

    output:
    hasher is the HASH object created by the hashlib function
    '''
    blockSize = 2 ** 16
    fileHash = md5.new()
    try:
        f = open(FILE_NAME, 'rb')
        buf = f.read(blockSize)
        while len(buf) > 0:
            fileHash.update(buf)
            buf = f.read(blockSize)
        f.close()
        return fileHash
    except IOError:
        return md5.new('bad_hash')
开发者ID:swacad,项目名称:Hash_Dir,代码行数:28,代码来源:hash_file_2_4.py


示例17: GET

 def GET(self):
     dict = {}
     for i in range(random.randint(1,3)):
     # Access Points 
         m = md5.new()
         ap = wifiobjects.accessPoint(self.randSent(8))
         m.update(str(ap.fts)+ap.bssid)
         # Attached clients
         for z in range(random.randint(0,3)):
             client = wifiobjects.client(self.randSent(8))
             # probes
             for x in range(random.randint(0,3)):
                 client.updateProbes(self.randSent(8))
             client.bssid = ap
             ap.addClients(client)
         
         dict[m.hexdigest()] = ap.__dict__
     # Unattached Clients
     for y in range(random.randint(0,2)):
         m = md5.new()
         client = wifiobjects.client(self.randSent(8))
         m.update(str(client.fts)+client.mac)
         # Unattached Client Probes
         for x in range(random.randint(0,3)):
    	        client.updateProbes(self.randSent(8))
         dict[m.hexdigest()] = client.__dict__
     
     # Give the JSON-encoded, dictionaried dictionary back
     pdb.set_trace()
     return json.dumps(dict)
开发者ID:Crypt0s,项目名称:airview,代码行数:30,代码来源:show.py


示例18: check_pwd

 def check_pwd(self, pwd):
     if os.path.exists(self.keyfile):
         with open(self.keyfile, 'rb') as f:
             if md5.new(md5.new(((pwd).encode("base64")).encode("hex")).digest()).hexdigest() == f.read(): return True
             else: return False
             f.close()
     else: return False
开发者ID:Adrael,项目名称:PassManager,代码行数:7,代码来源:Manage.py


示例19: save

	def save(self, *args, **kwargs):
		if not self.timestamp:
			self.timestamp = timezone.now()
		if not self.publish_key:
			self.publish_key = md5.new(''.join([random.choice(string.letters) for i in range(20)])).hexdigest()
			self.subscription_key = md5.new(self.publish_key + 'subscription_key').hexdigest()
		super(Stream, self).save(*args, **kwargs)
开发者ID:gpitfield,项目名称:django-birkenhead-streams,代码行数:7,代码来源:models.py


示例20: generate_digest

    def generate_digest(self, auth, handler, username, password):
        import md5
        import os

        # FIXME: This only does the MD5 algorithm (not MD5-sess) and
        # only the "auth" qop (quality of protection), not "auth-int"

        auth_info = parse_keqv_list(parse_http_list(auth))

        A1 = md5.new(username + ":" +
                     auth_info["realm"] + ":" +
                     password).hexdigest()
        A2 = md5.new("POST:" + handler).hexdigest()

        cnonce = md5.new("%s:%s:%s" % (str(self),
                                       str(os.getpid()),
                                       str(time.time()))).hexdigest()
        
        response = md5.new(A1 + ":" + auth_info["nonce"] +
                           ":00000001:" + cnonce +
                           ":auth:" + A2).hexdigest()

        self.__auth_data = 'Digest username="%s", realm="%s", nonce="%s", ' \
                           'cnonce="%s", nc=00000001, qop=auth, uri="%s", ' \
                           'response="%s"' % (username, auth_info["realm"],
                                              auth_info["nonce"], cnonce,
                                              handler, response)
开发者ID:joeshaw,项目名称:red-carpet,代码行数:27,代码来源:ximian_xmlrpclib.py



注:本文中的md5.new函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python mdTestUtilities.makeTempDir函数代码示例发布时间:2022-05-27
下一篇:
Python md5.md5函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap