3 #ifdef DC_SHA1_EXTERNAL
 
   5  * Same as SHA1DCInit, but with default save_hash=0
 
   7 void git_SHA1DCInit(SHA1_CTX *ctx)
 
  10         SHA1DCSetSafeHash(ctx, 0);
 
  15  * Same as SHA1DCFinal, but convert collision attack case into a verbose die().
 
  17 void git_SHA1DCFinal(unsigned char hash[20], SHA1_CTX *ctx)
 
  19         if (!SHA1DCFinal(hash, ctx))
 
  21         die("SHA-1 appears to be part of a collision attack: %s",
 
  22             hash_to_hex_algop(hash, &hash_algos[GIT_HASH_SHA1]));
 
  26  * Same as SHA1DCUpdate, but adjust types to match git's usual interface.
 
  28 void git_SHA1DCUpdate(SHA1_CTX *ctx, const void *vdata, unsigned long len)
 
  30         const char *data = vdata;
 
  31         /* We expect an unsigned long, but sha1dc only takes an int */
 
  32         while (len > INT_MAX) {
 
  33                 SHA1DCUpdate(ctx, data, INT_MAX);
 
  37         SHA1DCUpdate(ctx, data, len);