URI: 
       dup-check: Print hashes of corrupt blocks - dedup - deduplicating backup program
  HTML git clone git://bitreich.org/dedup/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/dedup/
   DIR Log
   DIR Files
   DIR Refs
   DIR Tags
   DIR README
   DIR LICENSE
       ---
   DIR commit fb016d2858d1d77359c56f4d67070fc8386879b6
   DIR parent bfcf7e2d112888bb42b40e2d25211edc7375f8c5
  HTML Author: sin <sin@2f30.org>
       Date:   Sun,  5 May 2019 20:56:51 +0100
       
       dup-check: Print hashes of corrupt blocks
       
       Diffstat:
         M dup-check.1                         |       3 +++
         M dup-check.c                         |      14 +++++++++++++-
       
       2 files changed, 16 insertions(+), 1 deletion(-)
       ---
   DIR diff --git a/dup-check.1 b/dup-check.1
       @@ -19,6 +19,9 @@ This is done by recalculating the hash of
        all blocks contained in the snapshot and checking
        whether the recorded hash of each block matches the
        actual hash.
       +.sp
       +If a corrupt block is detected, the hash of the
       +block will be printed on standard output.
        .Sh OPTIONS
        .Bl -tag -width "-k keyfile"
        .It Fl k Ar keyfile
   DIR diff --git a/dup-check.c b/dup-check.c
       @@ -8,6 +8,8 @@
        #include <stdlib.h>
        #include <unistd.h>
        
       +#include <sodium.h>
       +
        #include "arg.h"
        #include "block.h"
        #include "config.h"
       @@ -24,9 +26,19 @@ check(struct sctx *sctx, struct bctx *bctx)
                unsigned char md[MDSIZE];
                int n;
        
       +        if (sodium_init() < 0)
       +                errx(1, "sodium_init: failed");
       +
                while ((n = sget(sctx, md)) == MDSIZE) {
       -                if (bcheck(bctx, md) < 0)
       +                char mdstr[MDSIZE * 2 + 1];
       +                int r;
       +
       +                if ((r = bcheck(bctx, md)) < 0) {
                                berr("bcheck");
       +                } else if (r > 0) {
       +                        sodium_bin2hex(mdstr, sizeof(mdstr), md, MDSIZE);
       +                        puts(mdstr);
       +                }
                }
                if (n < 0)
                        serr("sget");