ftp获取文件的md5

2024-04-03 0 1
手机查看
import ftplib
import hashlib

def get_ftp_md5(ftp, remote_path):
    m = hashlib.md5()
    ftp.retrbinary('RETR %s' % file_remote_path, m.update)
    return m.hexdigest()

ftp.voidcmd("XSHA1 " + filename)

参加:MD5 value for file in a remote FTP server using Python ftplib

本地文件获取 md5

hashlib.md5(open('filename.exe','rb').read()).hexdigest()

字符串获取 md5

Hashlib. Md 5 ("example string"). Hexdigest ()

参加:How do I calculate the MD5 checksum of a file in Python?

What do you think?
  • 点赞
    0
    点赞
  • 踩一下
    0
    踩一下
  • 酷毙了
    0
    酷毙了
  • 不屑
    0
    不屑
  • 尴尬
    0
    尴尬
  • 无聊
    0
    无聊
Comments
  • Latest
  • Oldest
  • Hottest
Powered by Waline v3.5.6