1
0
mirror of https://github.com/r4sas/py-i2phosts synced 2025-01-22 20:44:55 +00:00

validation.py: check for pasting i2p router hash

This commit is contained in:
Hidden Z 2010-10-22 19:36:49 +00:00
parent a287860619
commit 700391d6e8

View File

@ -69,6 +69,10 @@ def validate_b64hash(data, check_uniq=True):
# fail if contains .i2p= (full foo.i2p=key)
if re.search(r'\.i2p=', data):
raise forms.ValidationError('Do not paste full hosts.txt entry! Only base64 hash are needed')
# check for pasting router hash
if length == 44:
raise forms.ValidationError('Do not paste router hash! Go to i2ptunnel page and \
find a destination hash')
# Minimum key length 516 bytes
if length < 516:
raise forms.ValidationError('Specified base64 hash are less than 516 bytes')