sorry, this one adds the previous commit about hashcash being dangerous...previous adds a symlink so clients can use it...grrr git is a mess within a mess

This commit is contained in:
Eric Wustrow
2012-07-17 21:11:38 -04:00
parent 9f1df2b704
commit cf45b233f7
+8 -8
View File
@@ -120,15 +120,15 @@ def check(stamp, resource=None, bits=None,
return False
if resource is not None and resource != res:
return False
elif check_expiration is not None:
if check_expiration is not None:
good_until = strftime("%y%m%d%H%M%S", localtime(time()-check_expiration))
if date < good_until:
return False
elif callable(ds_callback) and ds_callback(stamp):
if callable(ds_callback) and ds_callback(stamp):
return False
elif type(bits) is not int:
if type(bits) is not int:
return True
else:
hex_digits = int(floor(bits/4))
return sha(stamp).hexdigest().startswith('0'*hex_digits)
elif stamp.startswith('1:'): # Version 1
@@ -139,15 +139,15 @@ def check(stamp, resource=None, bits=None,
return False
if resource is not None and resource != res:
return False
elif type(bits) is int and bits > int(claim):
if type(bits) is int and bits > int(claim):
return False
elif check_expiration is not None:
if check_expiration is not None:
good_until = strftime("%y%m%d%H%M%S", localtime(time()-check_expiration))
if date < good_until:
return False
elif callable(ds_callback) and ds_callback(stamp):
if callable(ds_callback) and ds_callback(stamp):
return False
else:
hex_digits = int(floor(int(claim)/4))
return sha(stamp).hexdigest().startswith('0'*hex_digits)
else: # Unknown ver or generalized hashcash