Python Module Learning hashlib module Learning

Source: Internet
Author: User
Tags md5 encryption

1 #Cryptographic Modules2 ImportHashlib3 4 #MD5 encryption MD55 #1. Initialize the MD5 module to generate the MD5 object6 #2. Introduce the data update to be encrypted7 #3. Get the encrypted value Hexdigest8m =hashlib.md5 ()9M.update ('Hello World'. Encode ('UTF8'))#The default character encoding in Python3 is UnicodeTen Print(M.hexdigest ())#5EB63BBBE01EEED093CB22BB8F5ACDC3 One  A #SHA Encryption sha256 The most call mode - #1. Initializing the Sha256 object - #2. Introduction of data to be encrypted the #3. Get Encrypted values -M1 =hashlib.sha256 () -M1.update ("Hello World". Encode ("UTF8")) - Print(M1.hexdigest ())#B94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9

Python Module Learning hashlib module Learning

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.