MD5 hash With ftplib
Question: 
    >>>import ftplib 
    >>>import hashlib
    
    >>>ftp = ftplib.FTP('localhost','username','password')
    >>>ftp.cwd('Server')
    '250 Directory successfully changed.'
    >>>m=hashlib.md5()
    >>> file = open('Desktop/space.png','rb')
    >>> m.update("space.png")
    >>> dd = m.hexdigest()
    >>> dd
    'f646cdee237bd84e33485eb03c9228ac'
    >>> ftp.storbinary('STOR '+dd, file)
    '226 Transfer complete.'
    >>> file.close()
    >>> ftp.quit()
    '221 Goodbye.'
    >>> 
    

How to store different hexadecimal digits file? As this Python code keep
storing the same hexadecimal digits file. Anyone got any idea?


Answer: MD5 of `"space.png"` will always be `f646cdee237bd84e33485eb03c9228ac`. You
don't explain what you're trying to do exactly. If you're trying to use unique
filenames which are MD5 hashes, you can try something like this.

    
    
    import uuid
    m.update(str(uuid.uuid4()))
    dd = m.hexdigest()
    ftp.storbinary('STOR '+dd, file)  
    

`uuid.uuid4()` will generate a universally unique identifier whose MD5 hash
will practically be unique.

