python中hashlib md5,,如下两种方法,结果相


如下两种方法,结果相同

import hashlibimport timem = hashlib.md5()m.update(str(time.time()).encode(‘utf-8‘))print(m.hexdigest())m2 = hashlib.md5(str(time.time()).encode(‘utf-8‘))print(m2.hexdigest())# ad8720ac04abb38e20d79093b18505c1# ad8720ac04abb38e20d79093b18505c1

import hashlibimport timem = hashlib.md5()m.update(str(time.time()).encode(‘utf-8‘))m.update(‘lcg‘.encode(‘utf-8‘))print(m.hexdigest())m2 = hashlib.md5((str(time.time())+‘lcg‘).encode(‘utf-8‘))print(m2.hexdigest())# 0f1bd01d97cd41525cd79b27b6e0b5ba# 0f1bd01d97cd41525cd79b27b6e0b5ba

  

python中hashlib md5

评论关闭