Hashilib module and HMAC module

Source: Internet
Author: User
Tags hmac

For cryptographic related operations, the 3.x replaces the MD5 module and the SHA module, mainly providing the SHA1,SHA224,SHA256,SHA384,SHA512,MD5 algorithm (SHA512 the most complex and safest)

>>>ImportHashlib>>> m =hashlib.md5 () # Other encryption algorithms in the same vein>>> M.update ('666')>>>m.hexdigest () # 16 binary format Hash'Fae0b27c451c728867a567e8c1bb4e53'>>> M.update ('888')>>>m.hexdigest ()'75e266f182b4fa3625d4a4f4f779af54'>>> m_new =hashlib.md5 ()>>> M_new.update ('666888')>>>m_new.hexdigest ()'75e266f182b4fa3625d4a4f4f779af54'

The HMAC module internally creates key and content for us to process and then encrypt

>>> h = hmac.new (b'Where can I go a little later', b'go to the hospital')>>> h.hexdigest ()'8017d0aa2a051905ed8f821c3e2bdce5  '

Hashilib module and HMAC module

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.