Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use hashilb module

Shulou Source: shulou.com Published: 2022-06-02 11:53:08 11月15日 Update

This article will explain in detail how to use the hashilb module. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.

Import hashlib

#

M=hashlib.md5 ()

M.update (b "hello")

Print (m.hexdigest ()) # hash in hexadecimal format

Print (m.digest ()) # hash in binary format

M.update (b "It's me") # hello+it's me

Print (m.hexdigest ())

M.update (b "go to the school")

Print (m.hexdigest ())

M2=hashlib.md5 ()

M2.update ("helloIt's me King cover Tiger" .encode (encoding= "UTF-8")) # encode byte mode (bytes)

Print (m2.hexdigest ())

S2=hashlib.sha1 ()

S2.update (b "helloIt's me")

Print (s2.hexdigest ())

Import hmac

H=hmac.new (b "12345", "you are 250King" .encode (encoding= "UTF-8"))

Print (h.digest ()) # does not support Chinese (requires encode)

Print (h.hexdigest ()) # does not support Chinese

This is the end of the article on "how to use the hashilb module". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

Tags: Articles modules more format binary heavenly king UTF-8 Chinese support good practical content bytes articles patterns knowledge ground tiger reference help related Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology Redmi vpn Linux MySQL