Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZEO
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
ZEO
Commits
6a8febd4
Commit
6a8febd4
authored
Mar 30, 2009
by
Andreas Jung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
using ZEO.hash
parent
b697e8fd
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
src/ZEO/auth/auth_digest.py
src/ZEO/auth/auth_digest.py
+3
-3
No files found.
src/ZEO/auth/auth_digest.py
View file @
6a8febd4
...
@@ -57,7 +57,7 @@ def get_random_bytes(n=8):
...
@@ -57,7 +57,7 @@ def get_random_bytes(n=8):
return
s
return
s
def
hexdigest
(
s
):
def
hexdigest
(
s
):
return
sha1
.
new
(
s
).
hexdigest
()
return
sha1
(
s
).
hexdigest
()
class
DigestDatabase
(
Database
):
class
DigestDatabase
(
Database
):
def
__init__
(
self
,
filename
,
realm
=
None
):
def
__init__
(
self
,
filename
,
realm
=
None
):
...
@@ -77,7 +77,7 @@ def session_key(h_up, nonce):
...
@@ -77,7 +77,7 @@ def session_key(h_up, nonce):
# HMAC wants a 64-byte key. We don't want to use h_up
# HMAC wants a 64-byte key. We don't want to use h_up
# directly because it would never change over time. Instead
# directly because it would never change over time. Instead
# use the hash plus part of h_up.
# use the hash plus part of h_up.
return
sha1
.
new
(
"%s:%s"
%
(
h_up
,
nonce
)).
digest
()
+
h_up
[:
44
]
return
sha1
(
"%s:%s"
%
(
h_up
,
nonce
)).
digest
()
+
h_up
[:
44
]
class
StorageClass
(
ZEOStorage
):
class
StorageClass
(
ZEOStorage
):
def
set_database
(
self
,
database
):
def
set_database
(
self
,
database
):
...
@@ -93,7 +93,7 @@ class StorageClass(ZEOStorage):
...
@@ -93,7 +93,7 @@ class StorageClass(ZEOStorage):
def
_get_nonce
(
self
):
def
_get_nonce
(
self
):
# RFC 2069 recommends a nonce of the form
# RFC 2069 recommends a nonce of the form
# H(client-IP ":" time-stamp ":" private-key)
# H(client-IP ":" time-stamp ":" private-key)
dig
=
sha1
.
sha
()
dig
=
sha1
()
dig
.
update
(
str
(
self
.
connection
.
addr
))
dig
.
update
(
str
(
self
.
connection
.
addr
))
dig
.
update
(
self
.
_get_time
())
dig
.
update
(
self
.
_get_time
())
dig
.
update
(
self
.
noncekey
)
dig
.
update
(
self
.
noncekey
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment