Hi, it would be great, if the sftp protocol could be enhanced: get sha (or other hash value) from a file or part of a file. This would make it possible to run a rsync like file transfer on sftp. I would suggest a protocol like this Client sends to Server: get-supported hash-methods returns whitespace seperated list like md5 sha1 sha256 .... get-hash HASH-METHOD FILENAME STARTOFFSET BYTECOUNT returns: hexlified hash value (all lowercase) To get the hash value of the whole file: STARTOFFSET=0 and BYTECOUNT=0 Anyone interested? Thomas G?ttler
On Wednesday 29 June 2011, Thomas G?ttler wrote:> This would make it possible to run a rsync like file transfer > on sftp.Well, this would work for append-only files; if bytes get inserted or deleted in the middle, you'd need a Manber-Hash like rsync uses. But then you'd be reimplementing rsync anyway...> To get the hash value of the whole file: STARTOFFSET=0 and BYTECOUNT=0Better make that BYTECOUNT=-1, that's easier for divide-and-conquer strategies - and it works for the case when the file is zero bytes long, too. Regards, Phil
I could see various uses of this, and its not like OpenSSH doesn't already have sha1 built in. It could also be hacked in via a command line channel, seeking sha1sum or a perl oneliner. On Wed, Jun 29, 2011 at 3:57 AM, Thomas G?ttler <guettli at thomas-guettler.de>wrote:> Hi, > > it would be great, if the sftp protocol could be > enhanced: get sha (or other hash value) from a file or part of a file. > > This would make it possible to run a rsync like file transfer > on sftp. > > I would suggest a protocol like this > > Client sends to Server: > > get-supported hash-methods > > returns whitespace seperated list like md5 sha1 sha256 .... > > get-hash HASH-METHOD FILENAME STARTOFFSET BYTECOUNT > > returns: hexlified hash value (all lowercase) > > To get the hash value of the whole file: STARTOFFSET=0 and BYTECOUNT=0 > > Anyone interested? > > Thomas G?ttler > _______________________________________________ > openssh-unix-dev mailing list > openssh-unix-dev at mindrot.org > https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev >
> it would be great, if the sftp protocol could be > enhanced: get sha (or other hash value) from a file or part of a file. > > This would make it possible to run a rsync like file transfer > on sftp. > > I would suggest a protocol like this > > Client sends to Server: > > get-supported hash-methods > > returns whitespace seperated list like md5 sha1 sha256 .... > > get-hash HASH-METHOD FILENAME STARTOFFSET BYTECOUNT > > returns: hexlified hash value (all lowercase) > > To get the hash value of the whole file: STARTOFFSET=0 and BYTECOUNT=0 > > Anyone interested?Rather than reinventing the wheel, you might take a look at the (expired) Draft which proposed the "check-file-name" and "check-file-handle" SFTP extensions: http://tools.ietf.org/html/draft-ietf-secsh-filexfer-extensions-00 These extensions have been implemented by various SFTP clients and servers. Cheers, TJ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To spend too much time in studies is sloth. -Francis Bacon ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Am 29.06.2011 18:37, schrieb TJ Saunders:> >> it would be great, if the sftp protocol could be >> enhanced: get sha (or other hash value) from a file or part of a file....> > Rather than reinventing the wheel, you might take a look at the (expired) > Draft which proposed the "check-file-name" and "check-file-handle" SFTP > extensions: > > http://tools.ietf.org/html/draft-ietf-secsh-filexfer-extensions-00 > > These extensions have been implemented by various SFTP clients and > servers.Thank you very much! I googled for server which support check-file-hanlde, but I found only proftpd which supports it. The ietf extension is even better than my first proposal: You can give a blocksize and get N hash values with one response. I not a fluent c programmer. Any volunteers to implement this? Thomas G?ttler
...>> Rather than reinventing the wheel, you might take a look at the (expired) >> Draft which proposed the "check-file-name" and "check-file-handle" SFTP >> extensions: >> >> http://tools.ietf.org/html/draft-ietf-secsh-filexfer-extensions-00 >> >> These extensions have been implemented by various SFTP clients and >> servers. > > Thank you very much! I googled for server which support > check-file-hanlde, but I found only proftpd which supports it. > > The ietf extension is even better than my first proposal: You can > give a blocksize and get N hash values with one response. > > I not a fluent c programmer. Any volunteers to implement this?Hi, I opened a "search for help" on openhatch: http://openhatch.org/+projects/sftp%20get%20hash%20value Maybe someone can help us ... Thomas