Python: Two ways to generate MD5 values

test environment

  • Python 3.9.12
  • feapder 1.7.9

Option One

from hashlib import md5

print(md5(str('123' + '456').encode('utf8')).hexdigest())

operation result

e10adc3949ba59abbe56e057f20f883e

Option II

from feapder.utils import tools

print(tools.get_md5('123' + '456'))

operation result

e10adc3949ba59abbe56e057f20f883e

illustrate

  • The dependent library in Option 1 comes with Python, and Option 2 requires manual installation of third-party libraries feapder.
  • The second scheme is the encapsulation of the first scheme.
  • Similar methods in tools include get_sha1(), get_base64(), get_uuid(),get_hash()

Guess you like

Origin blog.csdn.net/qq_34562959/article/details/127372863