Does duplicacy send the optional SHA-1 hash to B2 during upload?


The B2 upload API allows uploaded files to be sent with an optional SHA-1 hash in the http header. B2 uses this hash to determine if an upload is successful or not. This guarantees that an uploaded file is actually stored 100% at B2 without any corruption during upload. If the hash doesn’t match after it’s uploaded, it returns an error that the upload failed and of course Duplicacy will retry the upload if B2 throws an error. You never have to store the SHA-1, it’s used only during upload.

That’s all great, wonderful actually. My question is, since this SHA-1 hash is an “optional” B2 feature, and since Duplicacy stores hashes itself with Blake2, does Duplicacy actually use this optional SHA-1 hash feature with B2 uploads? Or does Duplicacy not do this because of the SHA vs Blake issue?


It looks like duplicacy is already using the recommended SHA1 hash for uploads.

See the UploadFile function in the b2client. Particularly this line:

request.Header.Set("X-Bz-Content-Sha1", hash)