better auth.wiki

This commit is contained in:
mdipierro
2012-07-18 18:24:58 -05:00
parent a63b80735b
commit 0700ed7c8e
3 changed files with 33 additions and 18 deletions
+3 -3
View File
@@ -327,8 +327,8 @@ def URL(
# re-assembling the same way during hash authentication
message = h_args + '?' + urllib.urlencode(sorted(h_vars))
sig = hmac_hash(message, hmac_key, digest_alg='sha1', salt=salt)
sig = hmac_hash(message, (hmac_key or '')+(salt or ''),
digest_alg='sha1')
# add the signature into vars
list_vars.append(('_signature', sig))
@@ -447,7 +447,7 @@ def verifyURL(request, hmac_key=None, hash_vars=True, salt=None, user_signature=
message = h_args + '?' + urllib.urlencode(sorted(h_vars))
# hash with the hmac_key provided
sig = hmac_hash(message, str(hmac_key), digest_alg='sha1', salt=salt)
sig = hmac_hash(message, str(hmac_key)+(salt or ''), digest_alg='sha1')
# put _signature back in get_vars just in case a second call to URL.verify is performed
# (otherwise it'll immediately return false)