def verify_ip_hash_cookie(hash_cookie_value):
"""
??cookie??hash??????????
? human_ip_verification ?????
hash??14?
hash(?7?+salt) = ?7? ???????
:type hash_cookie_value: str
:rtype: bool
"""
try:
input_key_hash = hash_cookie_value[:8]
output_hash = hash_cookie_value[8:]
calculated_hash = hex(zlib.adler32(
(input_key_hash + human_ip_verification_answers_hash_str).encode(encoding='utf-8')
))[2:]
if output_hash == calculated_hash:
return True
else:
return False
except:
return False
评论列表
文章目录