Closed BingYanchi closed 4 years ago
Yeah, looks like the example should be changed from:
hash = md5('12345').hexdigest()
to:
password = '12345'
if sys.version_info >= (3, 0):
password = password.encode('latin1')
hash = md5(password).hexdigest()
(because Python 3 treats bytes differently to strings)
Also, looks like:
def validate_authentication(self, username, password, handler):
if sys.version_info >= (3, 0):
password = md5(password.encode('latin1'))
hash = md5(password).hexdigest()
should probably be:
def validate_authentication(self, username, password, handler):
if sys.version_info >= (3, 0):
password = password.encode('latin1')
hash = md5(password).hexdigest()
?
No point calling the md5
function twice! :laughing:
Anyone up for a PR? :D
https://pyftpdlib.readthedocs.io/en/latest/tutorial.html?highlight=md5#storing-passwords-as-hash-digests
Prompt after running:
I change to
hash = md5('12345'.encode('latin1')).hexdigest()
But still report an error, I hope to give the corresponding new method