in reply to get md5 sum of a remote file via net::ftp / net::sftp

As pointed out, unless there is a precalculated md5 of the file published at the remote end that you can compare your locally calculated value against, calculating an md5 locally doesn't buy you anything.

For a simplistic check, but one that will detect common errors like ascii-v-binary tranfers and partial transfers, use the size method of NET::Ftp to get the remote size of the file and compare that against the local size after transfer. It won't detect in-transit corruption nor deliberate replacements, but then neither will a local MD5 without something reliable to compare against.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^2: get md5 sum of a remote file via net::ftp / net::sftp
by avo (Pilgrim) on May 11, 2006 at 20:53 UTC
    Very good point. I think I will write a daemon that does MD5 for me via TCP/IP and then do the FTP having the MD5 of the remote file before the transfer. SSH is a good idea as well. I will now just have to decide on the quickest. I have POE server in mind - that will be quick enough ... Will post the script here when done.