int binary = 0;
char *buffer;
const struct git_hash_algo *algop = &hash_algos[algo];
+ if (unsafe)
+ algop = unsafe_hash_algo(algop);
if (ac == 2) {
if (!strcmp(av[1], "-b"))
die("OOPS");
}
- if (unsafe)
- algop->unsafe_init_fn(&ctx);
- else
- algop->init_fn(&ctx);
+ algop->init_fn(&ctx);
while (1) {
ssize_t sz, this_sz;
}
if (this_sz == 0)
break;
- if (unsafe)
- algop->unsafe_update_fn(&ctx, buffer, this_sz);
- else
- algop->update_fn(&ctx, buffer, this_sz);
+ algop->update_fn(&ctx, buffer, this_sz);
}
- if (unsafe)
- algop->unsafe_final_fn(hash, &ctx);
- else
- algop->final_fn(hash, &ctx);
+ algop->final_fn(hash, &ctx);
if (binary)
fwrite(hash, 1, algop->rawsz, stdout);