URI: 
       tFunction to compare hashes - synk - synchronize files between hosts
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
   DIR commit 8e9a6f6cd8321f42ac8d55456b1092ef7a61f191
   DIR parent e107f99cfc32c18f5c8902f461b70336973de2d5
  HTML Author: Willy <willyatmailoodotorg>
       Date:   Mon, 22 Aug 2016 08:41:20 +0200
       
       Function to compare hashes
       
       Diffstat:
         M synk.c                              |      17 +++++++++++++++++
       
       1 file changed, 17 insertions(+), 0 deletions(-)
       ---
   DIR diff --git a/synk.c b/synk.c
       t@@ -36,6 +36,7 @@ int handleclient(int cfd, struct in_addr inet);
        int server(in_addr_t host, in_port_t port);
        int client(in_addr_t host, in_port_t port, const char *path);
        int sha512(FILE *stream, unsigned char *hash);
       +int sha512_compare(unsigned char *h1, unsigned char *h2);
        
        void
        usage(char *name)
       t@@ -70,6 +71,22 @@ sha512(FILE *stream, unsigned char *hash)
        }
        
        /*
       + * Return 0 is two sha512 hashes match together, 1 otherwise.
       + * Hashes MUST be 64 byte long, and not NULL.
       + */
       +int
       +sha512_compare(unsigned char *h1, unsigned char *h2)
       +{
       +        int i;
       +        for (i=0; i<64; i++) {
       +                if (h1[i] != h2[i])
       +                        return 1;
       +        }
       +
       +        return 0;
       +}
       +
       +/*
         * Returns the UNIX timestamp for the given file, or -1 in case stat(2)
         * is in error.
         */