Last active
August 29, 2015 13:57
-
-
Save berlotto/9647928 to your computer and use it in GitHub Desktop.
A Python server side implementation for jQuery Real Person Plugin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
#------------------------------ | |
def rpHash(person): | |
hash = 5381 | |
value = person.upper() | |
for caracter in value: | |
hash = (( np.left_shift(hash, 5) + hash) + ord(caracter)) | |
hash = np.int32(hash) | |
return hash | |
#----------------------------- | |
if rpHash(request.form['realPerson']) == request.form['realPersonHash']: | |
print "Your are a real person!" | |
else: | |
print "You are a bot!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks