Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1226)

Side by Side Diff: third_party/twisted_8_1/twisted/cred/util.py

Issue 12261012: Remove third_party/twisted_8_1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1
2 # Copyright (c) 2001-2004 Twisted Matrix Laboratories.
3 # See LICENSE for details.
4
5
6 """
7 Utility functions for authorization.
8
9 These are currently for challenge-response shared secret authentication.
10
11 Maintainer: U{Glyph Lefkowitz<mailto:glyph@twistedmatrix.com>}
12 """
13
14 # System Imports
15 import md5
16 import random
17
18 from twisted.cred.error import Unauthorized
19
20 def respond(challenge, password):
21 """Respond to a challenge.
22 This is useful for challenge/response authentication.
23 """
24 m = md5.new()
25 m.update(password)
26 hashedPassword = m.digest()
27 m = md5.new()
28 m.update(hashedPassword)
29 m.update(challenge)
30 doubleHashedPassword = m.digest()
31 return doubleHashedPassword
32
33 def challenge():
34 """I return some random data.
35 """
36 crap = ''
37 for x in range(random.randrange(15,25)):
38 crap = crap + chr(random.randint(65,90))
39 crap = md5.new(crap).digest()
40 return crap
OLDNEW
« no previous file with comments | « third_party/twisted_8_1/twisted/cred/strcred.py ('k') | third_party/twisted_8_1/twisted/enterprise/__init__.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698