2 ms·
> you’re going to need to read every byte anyway! But you might not need to read them at your current location, though that consideration might be overkill for
by dspillett 3y ago
> you’re going to need to read every byte anyway!
But you might not need to read them at your current location, though that consideration might be overkill for the level this article is aimed at.
For instance reading a full remote file to compare it to a local one byte-for-byte will be slower than
sha256sum some.file; ssh user@host sha256sum some.file
or
cmp <(sha256sum some.file) <(ssh user@host sha256sum some.file)
unless the file is very small (in which case a simple download by HTTP(S) or read via network filesystem may be faster than negotiating a SSH connection and running the remote hash command). In either case accessing a pre-computed hash of the remote content will likely be faster than both options, assuming a stored hash exists and you are looking to verify your local copy.