Python in Hashlib MD5

Source: Internet
Author: User

The results are the same in two ways

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

Or

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 in Hashlib MD5

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.