java - Getting MD5 checksum on the remote server using JSCH -
i writing application requirement transfer files remote sftp server local machine , vice - versa. during file transfer want make sure no data packets lost , corrupted in transit.so idea run md5 checksum on remote file (residing in sftp server) before transfer , start transfer process. once transfer done, run md5 on local file , compare 2 checksums.
i using jsch connect sftp server , code in java.but dont know how run md5 on remote file residing in sftp server.my code has md5 on remote file before transfer takes place.any idea on how accomplish please.
most unix systems have md5sum
command. invoke on remote server retrieve hash.
$ md5sum /tmp/test 34a27208f62ff3bdae031c9e8a354ac3 /tmp/test
the jsch website contains an example shows how invoke command on remote server. adapted run md5sum
command.