+ } else if (fid >= 0 && ff_pkt->flags & FO_SHA1) {
+ char SHA1buf[40]; /* 24 should do */
+ SHA1Init(&sha1c);
+ while ((n=read(fid, jcr->big_buf, jcr->buf_size)) > 0) {
+ SHA1Update(&sha1c, ((unsigned char *) jcr->big_buf), n);
+ jcr->JobBytes += n;
+ }
+ if (n < 0) {
+ Jmsg(jcr, M_WARNING, -1, _("Error reading file %s: ERR=%s\n"),
+ ff_pkt->fname, strerror(errno));
+ }
+ SHA1Final(&sha1c, signature);
+
+ bin_to_base64(SHA1buf, (char *)signature, 20); /* encode 20 bytes */
+ Dmsg2(400, "send inx=%d SHA1=%s\n", jcr->JobFiles, SHA1buf);
+ bnet_fsend(dir, "%d %d %s *SHA1-%d*", jcr->JobFiles, STREAM_SHA1_SIGNATURE,
+ SHA1buf, jcr->JobFiles);
+ Dmsg2(20, "bfiled>bdird: SHA1 len=%d: msg=%s\n", dir->msglen, dir->msg);