warcsum/warcsum.c
/*
 * Update hash struct with input buffer
 */
Update hash struct with input buffer
Update hash struct with input buffer
int
hash_update (unsigned char* buffer, int hash,
             int input_length, void* hash_ctx)
{
  time_t now_hash;
  time (&now_hash);
  input_length = input_length < 0 ? 0 : input_length;
  switch (hash)
    {
    case 1: 
      return MD5_Update ((MD5_CTX*) hash_ctx, buffer, input_length);
    case 2: 
      return SHA1_Update ((SHA_CTX*) hash_ctx, buffer, input_length);
    case 3: 
      return SHA256_Update ((SHA256_CTX*) hash_ctx, buffer, input_length);
    case 4: 
      return SHA512_Update ((SHA512_CTX*) hash_ctx, buffer, input_length);
    default:
      fprintf (stderr, "Unknown hash algorithm: %d!!\n"
               "How did you get here?!\n\n", hash);
      exit (EXIT_FAILURE);
    }
  time_t then_hash;
  time (&then_hash);
  time_hash += difftime (then_hash, now_hash);
}
int hash_update ( unsigned char * buffer , int hash , int input_length , void * hash_ctx ) { time_t now_hash ; time ( & now_hash ) ; input_length = input_length < 0 ? 0 : input_length ; switch ( hash ) { case 1 : return MD5_Update ( ( MD5_CTX * ) hash_ctx , buffer , input_length ) ; case 2 : return SHA1_Update ( ( SHA_CTX * ) hash_ctx , buffer , input_length ) ; case 3 : return SHA256_Update ( ( SHA256_CTX * ) hash_ctx , buffer , input_length ) ; case 4 : return SHA512_Update ( ( SHA512_CTX * ) hash_ctx , buffer , input_length ) ; default : fprintf ( stderr , " \n " " \n \n " , hash ) ; exit ( EXIT_FAILURE ) ; } time_t then_hash ; time ( & then_hash ) ; time_hash += difftime ( then_hash , now_hash ) ; }
Update hash struct with input buffer
Update hash struct with input buffer
/* TIME */ /* END OF TIME */ // calculate md5 // calculate sha1 // calculate sha256 // calculate sha256 /* TIME */ /* END OF TIME */