Python 2:
# -*- coding: utf-8 -*- import hashlib s = 'jeżeli nie popełniłeś błędu tzn. że się niczego nie nauczyłeś' print(type(s)) m = hashlib.md5() m.update(s) print(m.hexdigest())Wyniki:
<type 'str'> f9e58600ead7130b26fab4f1b943b79bPython 3:
import hashlib
s = 'jeżeli nie popełniłeś błędu tzn. że się niczego nie nauczyłeś'
s = s.encode('utf-8')
print(type(s))
m = hashlib.md5()
m.update(s)
print(m.hexdigest())
Wyniki:<class 'bytes'> f9e58600ead7130b26fab4f1b943b79b
Brak komentarzy:
Prześlij komentarz