oeong
#!/usr/bin/python
# -*- coding: utf-8 -*-
import hashlib

def md5(str):
    hl = hashlib.md5()
    hl.update(str.encode(encoding=\'utf-8\'))
    return hl.hexdigest()

pwdFile = open(\'password\')  # 源文件
pwd = pwdFile.readlines()
md5File = open(\'md5Password.txt\', \'w\')  # 目标文件

print(pwd)
for p in pwd:
    print(md5(p.strip()))  # 去除尾部的换行符
    md5File.write(md5(p.strip()))
    md5File.write(\'\n\')

pwdFile.close()
md5File.close()

输出结果:

分类:

技术点:

相关文章:

  • 2021-09-29
  • 2021-12-12
  • 2021-10-01
  • 2021-10-01
  • 2021-10-11
  • 2021-10-11
  • 2021-06-22
猜你喜欢
  • 2021-12-31
  • 2022-02-06
  • 2021-11-01
  • 2022-01-24
  • 2021-09-29
  • 2021-11-01
  • 2021-11-01
相关资源
相似解决方案