Commit Diff


commit - 94ef25578c680bc8171b33b5e5b6037f2872abcb
commit + 3093e2d747a41afd623354136331c7babea32ca8
blob - e22197aef200b4b37d02bf22b05649f1af0a55a4
blob + 10dc2d3863fbc6030fffe9d6d2ef29795295e2b9
--- gotd/gotd.h
+++ gotd/gotd.h
@@ -410,7 +410,7 @@ struct gotd_imsg_packfile_progress {
 /* Structure for GOTD_IMSG_PACKFILE_INSTALL. */
 struct gotd_imsg_packfile_install {
 	uint32_t client_id;
-	uint8_t pack_sha1[SHA1_DIGEST_LENGTH];
+	uint8_t pack_hash[SHA1_DIGEST_LENGTH];
 };
 
 /* Structure for GOTD_IMSG_PACKFILE_DONE data. */
blob - de57ba5027a29b8074cadbe8bb9367f848c92623
blob + 7f17ae43bae907d9b742a0d4eef1d71f7b35c669
--- gotd/repo_imsg.c
+++ gotd/repo_imsg.c
@@ -44,11 +44,11 @@ gotd_imsg_send_ack(struct got_object_id *id, struct im
 	char hex[SHA1_DIGEST_STRING_LENGTH];
 
 	if (log_getverbose() > 0 &&
-	    got_sha1_digest_to_str(id->sha1, hex, sizeof(hex)))
+	    got_sha1_digest_to_str(id->hash, hex, sizeof(hex)))
 		log_debug("sending ACK for %s", hex);
 
 	memset(&iack, 0, sizeof(iack));
-	memcpy(iack.object_id, id->sha1, SHA1_DIGEST_LENGTH);
+	memcpy(iack.object_id, id->hash, SHA1_DIGEST_LENGTH);
 
 	if (imsg_compose(ibuf, GOTD_IMSG_ACK, peerid, pid, -1,
 	    &iack, sizeof(iack)) == -1) {
@@ -71,11 +71,11 @@ gotd_imsg_send_nak(struct got_object_id *id, struct im
 	char hex[SHA1_DIGEST_STRING_LENGTH];
 
 	if (log_getverbose() > 0 &&
-	    got_sha1_digest_to_str(id->sha1, hex, sizeof(hex)))
+	    got_sha1_digest_to_str(id->hash, hex, sizeof(hex)))
 		log_debug("sending NAK for %s", hex);
 
 	memset(&inak, 0, sizeof(inak));
-	memcpy(inak.object_id, id->sha1, SHA1_DIGEST_LENGTH);
+	memcpy(inak.object_id, id->hash, SHA1_DIGEST_LENGTH);
 
 	if (imsg_compose(ibuf, GOTD_IMSG_NAK, peerid, pid, -1,
 	    &inak, sizeof(inak)) == -1) {
blob - 658362effe9f7a546e607cdc600ad87c21b66f60
blob + 94a242f98628e3612e84539eb09cde4f5a91db10
--- gotd/repo_read.c
+++ gotd/repo_read.c
@@ -112,7 +112,7 @@ send_symref(struct got_reference *symref, struct got_o
 	memset(&isymref, 0, sizeof(isymref));
 	isymref.name_len = strlen(refname);
 	isymref.target_len = strlen(target);
-	memcpy(isymref.target_id, target_id->sha1, sizeof(isymref.target_id));
+	memcpy(isymref.target_id, target_id->hash, sizeof(isymref.target_id));
 
 	len = sizeof(isymref) + isymref.name_len + isymref.target_len;
 	if (len > MAX_IMSGSIZE - IMSG_HEADER_SIZE) {
@@ -183,7 +183,7 @@ send_peeled_tag_ref(struct got_reference *ref, struct 
 	}
 
 	/* Keep in sync with struct gotd_imsg_ref definition. */
-	if (imsg_add(wbuf, id->sha1, SHA1_DIGEST_LENGTH) == -1) {
+	if (imsg_add(wbuf, id->hash, SHA1_DIGEST_LENGTH) == -1) {
 		err = got_error_from_errno("imsg_add REF");
 		goto done;
 	}
@@ -232,7 +232,7 @@ send_ref(struct got_reference *ref, struct imsgbuf *ib
 	}
 
 	/* Keep in sync with struct gotd_imsg_ref definition. */
-	if (imsg_add(wbuf, id->sha1, SHA1_DIGEST_LENGTH) == -1)
+	if (imsg_add(wbuf, id->hash, SHA1_DIGEST_LENGTH) == -1)
 		return got_error_from_errno("imsg_add REF");
 	if (imsg_add(wbuf, &namelen, sizeof(namelen)) == -1)
 		return got_error_from_errno("imsg_add REF");
@@ -434,10 +434,10 @@ recv_want(struct imsg *imsg)
 	memcpy(&iwant, imsg->data, sizeof(iwant));
 
 	memset(&id, 0, sizeof(id));
-	memcpy(id.sha1, iwant.object_id, SHA1_DIGEST_LENGTH);
+	memcpy(id.hash, iwant.object_id, SHA1_DIGEST_LENGTH);
 
 	if (log_getverbose() > 0 &&
-	    got_sha1_digest_to_str(id.sha1, hex, sizeof(hex)))
+	    got_sha1_digest_to_str(id.hash, hex, sizeof(hex)))
 		log_debug("client wants %s", hex);
 
 	imsg_init(&ibuf, client->fd);
@@ -477,10 +477,10 @@ recv_have(struct imsg *imsg)
 	memcpy(&ihave, imsg->data, sizeof(ihave));
 
 	memset(&id, 0, sizeof(id));
-	memcpy(id.sha1, ihave.object_id, SHA1_DIGEST_LENGTH);
+	memcpy(id.hash, ihave.object_id, SHA1_DIGEST_LENGTH);
 
 	if (log_getverbose() > 0 &&
-	    got_sha1_digest_to_str(id.sha1, hex, sizeof(hex)))
+	    got_sha1_digest_to_str(id.hash, hex, sizeof(hex)))
 		log_debug("client has %s", hex);
 
 	imsg_init(&ibuf, client->fd);
@@ -619,7 +619,7 @@ send_packfile(struct imsg *imsg, struct gotd_imsgev *i
 	const struct got_error *err = NULL;
 	struct repo_read_client *client = &repo_read_client;
 	struct gotd_imsg_packfile_done idone;
-	uint8_t packsha1[SHA1_DIGEST_LENGTH];
+	uint8_t packhash[SHA1_DIGEST_LENGTH];
 	char hex[SHA1_DIGEST_STRING_LENGTH];
 	FILE *delta_cache = NULL;
 	struct imsgbuf ibuf;
@@ -646,7 +646,7 @@ send_packfile(struct imsg *imsg, struct gotd_imsgev *i
 	pa.ibuf = &ibuf;
 	pa.report_progress = client->report_progress;
 
-	err = got_pack_create(packsha1, client->pack_pipe, delta_cache,
+	err = got_pack_create(packhash, client->pack_pipe, delta_cache,
 	    client->have_ids.ids, client->have_ids.nids,
 	    client->want_ids.ids, client->want_ids.nids,
 	    repo_read.repo, 0, 1, pack_progress, &pa, &rl,
@@ -655,7 +655,7 @@ send_packfile(struct imsg *imsg, struct gotd_imsgev *i
 		goto done;
 
 	if (log_getverbose() > 0 &&
-	    got_sha1_digest_to_str(packsha1, hex, sizeof(hex)))
+	    got_sha1_digest_to_str(packhash, hex, sizeof(hex)))
 		log_debug("sent pack-%s.pack", hex);
 
 	memset(&idone, 0, sizeof(idone));
blob - b425ba49c41d4c20c076b2c6c6a77b84366abf0d
blob + fee7c5d9cc56be341cedac18180923310351e9b8
--- gotd/repo_write.c
+++ gotd/repo_write.c
@@ -86,7 +86,7 @@ static struct repo_write_client {
 	int				 fd;
 	int				 pack_pipe;
 	struct got_pack			 pack;
-	uint8_t				 pack_sha1[SHA1_DIGEST_LENGTH];
+	uint8_t				 pack_hash[SHA1_DIGEST_LENGTH];
 	int				 packidx_fd;
 	struct gotd_ref_updates		 ref_updates;
 	int				 nref_updates;
@@ -155,7 +155,7 @@ send_peeled_tag_ref(struct got_reference *ref, struct 
 	}
 
 	/* Keep in sync with struct gotd_imsg_ref definition. */
-	if (imsg_add(wbuf, id->sha1, SHA1_DIGEST_LENGTH) == -1) {
+	if (imsg_add(wbuf, id->hash, SHA1_DIGEST_LENGTH) == -1) {
 		err = got_error_from_errno("imsg_add REF");
 		goto done;
 	}
@@ -204,7 +204,7 @@ send_ref(struct got_reference *ref, struct imsgbuf *ib
 	}
 
 	/* Keep in sync with struct gotd_imsg_ref definition. */
-	if (imsg_add(wbuf, id->sha1, SHA1_DIGEST_LENGTH) == -1)
+	if (imsg_add(wbuf, id->hash, SHA1_DIGEST_LENGTH) == -1)
 		return got_error_from_errno("imsg_add REF");
 	if (imsg_add(wbuf, &namelen, sizeof(namelen)) == -1)
 		return got_error_from_errno("imsg_add REF");
@@ -365,8 +365,8 @@ recv_ref_update(struct imsg *imsg)
 		goto done;
 	}
 
-	memcpy(ref_update->old_id.sha1, iref.old_id, SHA1_DIGEST_LENGTH);
-	memcpy(ref_update->new_id.sha1, iref.new_id, SHA1_DIGEST_LENGTH);
+	memcpy(ref_update->old_id.hash, iref.old_id, SHA1_DIGEST_LENGTH);
+	memcpy(ref_update->new_id.hash, iref.new_id, SHA1_DIGEST_LENGTH);
 
 	err = got_ref_open(&ref, repo_write.repo, refname, 0);
 	if (err) {
@@ -422,7 +422,7 @@ recv_ref_update(struct imsg *imsg)
 	    repo_write.pid);
 
 	ref_update->ref = ref;
-	if (memcmp(ref_update->new_id.sha1, zero_id, sizeof(zero_id)) == 0) {
+	if (memcmp(ref_update->new_id.hash, zero_id, sizeof(zero_id)) == 0) {
 		ref_update->delete_ref = 1;
 		client->nref_del++;
 	}
@@ -696,7 +696,7 @@ validate_object_type(int obj_type)
 }
 
 static const struct got_error *
-recv_packdata(off_t *outsize, uint32_t *nobj, uint8_t *sha1,
+recv_packdata(off_t *outsize, uint32_t *nobj, uint8_t *hash,
     int infd, int outfd)
 {
 	const struct got_error *err;
@@ -705,7 +705,7 @@ recv_packdata(off_t *outsize, uint32_t *nobj, uint8_t 
 	size_t have;
 	uint32_t nhave = 0;
 	SHA1_CTX ctx;
-	uint8_t expected_sha1[SHA1_DIGEST_LENGTH];
+	uint8_t expected_hash[SHA1_DIGEST_LENGTH];
 	char hex[SHA1_DIGEST_STRING_LENGTH];
 	BUF *buf = NULL;
 	size_t buf_pos = 0, remain;
@@ -792,7 +792,7 @@ recv_packdata(off_t *outsize, uint32_t *nobj, uint8_t 
 
 	log_debug("received %u objects", *nobj);
 
-	SHA1Final(expected_sha1, &ctx);
+	SHA1Final(expected_hash, &ctx);
 
 	remain = buf_len(buf) - buf_pos;
 	if (remain < SHA1_DIGEST_LENGTH) {
@@ -802,20 +802,20 @@ recv_packdata(off_t *outsize, uint32_t *nobj, uint8_t 
 			return err;
 	}
 
-	got_sha1_digest_to_str(expected_sha1, hex, sizeof(hex));
+	got_sha1_digest_to_str(expected_hash, hex, sizeof(hex));
 	log_debug("expect SHA1: %s", hex);
 	got_sha1_digest_to_str(buf_get(buf) + buf_pos, hex, sizeof(hex));
 	log_debug("actual SHA1: %s", hex);
 
-	if (memcmp(buf_get(buf) + buf_pos, expected_sha1,
+	if (memcmp(buf_get(buf) + buf_pos, expected_hash,
 	    SHA1_DIGEST_LENGTH) != 0) {
 		err = got_error(GOT_ERR_PACKFILE_CSUM);
 		goto done;
 	}
 
-	memcpy(sha1, expected_sha1, SHA1_DIGEST_LENGTH);
+	memcpy(hash, expected_hash, SHA1_DIGEST_LENGTH);
 
-	w = write(outfd, expected_sha1, SHA1_DIGEST_LENGTH);
+	w = write(outfd, expected_hash, SHA1_DIGEST_LENGTH);
 	if (w == -1) {
 		err = got_error_from_errno("write");
 		goto done;
@@ -961,7 +961,7 @@ recv_packfile(int *have_packfile, struct imsg *imsg)
 
 	log_debug("receiving pack data");
 	unpack_err = recv_packdata(&pack_filesize, &nobj,
-	    client->pack_sha1, client->pack_pipe, pack->fd);
+	    client->pack_hash, client->pack_pipe, pack->fd);
 	if (ireq.report_status) {
 		err = report_pack_status(unpack_err);
 		if (err) {
@@ -1002,7 +1002,7 @@ recv_packfile(int *have_packfile, struct imsg *imsg)
 	log_debug("begin indexing pack (%lld bytes in size)",
 	    (long long)pack->filesize);
 	err = got_pack_index(pack, client->packidx_fd,
-	    tempfiles[0], tempfiles[1], tempfiles[2], client->pack_sha1,
+	    tempfiles[0], tempfiles[1], tempfiles[2], client->pack_hash,
 	    pack_index_progress, NULL, &rl);
 	if (err)
 		goto done;
@@ -1105,7 +1105,7 @@ install_packfile(struct gotd_imsgev *iev)
 
 	memset(&inst, 0, sizeof(inst));
 	inst.client_id = client->id;
-	memcpy(inst.pack_sha1, client->pack_sha1, SHA1_DIGEST_LENGTH);
+	memcpy(inst.pack_hash, client->pack_hash, SHA1_DIGEST_LENGTH);
 
 	ret = gotd_imsg_compose_event(iev, GOTD_IMSG_PACKFILE_INSTALL,
 	    PROC_REPO_WRITE, -1, &inst, sizeof(inst));
@@ -1145,8 +1145,8 @@ send_ref_update(struct gotd_ref_update *ref_update, st
 	size_t len;
 
 	memset(&iref, 0, sizeof(iref));
-	memcpy(iref.old_id, ref_update->old_id.sha1, SHA1_DIGEST_LENGTH);
-	memcpy(iref.new_id, ref_update->new_id.sha1, SHA1_DIGEST_LENGTH);
+	memcpy(iref.old_id, ref_update->old_id.hash, SHA1_DIGEST_LENGTH);
+	memcpy(iref.new_id, ref_update->new_id.hash, SHA1_DIGEST_LENGTH);
 	iref.ref_is_new = ref_update->ref_is_new;
 	iref.delete_ref = ref_update->delete_ref;
 	iref.client_id = client->id;
blob - d7e43c48876932a301c2aa803f93172a823359ec
blob + 2fc6c910bb457b3e9579ed53f280815b1e3745ee
--- gotd/session.c
+++ gotd/session.c
@@ -335,7 +335,7 @@ install_pack(struct gotd_session_client *client, const
 		return got_error_msg(GOT_ERR_BAD_REQUEST,
 		    "client has no pack file index");
 
-	if (got_sha1_digest_to_str(inst.pack_sha1, hex, sizeof(hex)) == NULL)
+	if (got_sha1_digest_to_str(inst.pack_hash, hex, sizeof(hex)) == NULL)
 		return got_error_msg(GOT_ERR_NO_SPACE,
 		    "could not convert pack file SHA1 to hex");
 
@@ -431,8 +431,8 @@ update_ref(int *shut, struct gotd_session_client *clie
 	if (err)
 		goto done;
 
-	memcpy(old_id.sha1, iref.old_id, SHA1_DIGEST_LENGTH);
-	memcpy(new_id.sha1, iref.new_id, SHA1_DIGEST_LENGTH);
+	memcpy(old_id.hash, iref.old_id, SHA1_DIGEST_LENGTH);
+	memcpy(new_id.hash, iref.new_id, SHA1_DIGEST_LENGTH);
 	err = got_object_open(&obj, repo,
 	    iref.delete_ref ? &old_id : &new_id);
 	if (err)
blob - 143943dab41bdfa1c563424971a783ce73ec6ca1
blob + 17dc58ae2833dd6e030301e154782fb31c1a0966
--- lib/deflate.c
+++ lib/deflate.c
@@ -86,8 +86,8 @@ csum_output(struct got_deflate_checksum *csum, const u
 	if (csum->output_crc)
 		*csum->output_crc = crc32(*csum->output_crc, buf, len);
 
-	if (csum->output_sha1)
-		SHA1Update(csum->output_sha1, buf, len);
+	if (csum->output_hash)
+		SHA1Update(csum->output_hash, buf, len);
 }
 
 const struct got_error *
blob - a006844341e6b3ee524360e3929fe3eee0536090
blob + 46b02711be8115b800d930bdce78cdbe0e26c7b5
--- lib/fetch.c
+++ lib/fetch.c
@@ -296,7 +296,7 @@ got_fetch_pack(struct got_object_id **pack_hash, struc
 
 		err = got_privsep_recv_fetch_progress(&done,
 		    &id, &refname, symrefs, &server_progress,
-		    &packfile_size_cur, (*pack_hash)->sha1, &fetchibuf);
+		    &packfile_size_cur, (*pack_hash)->hash, &fetchibuf);
 		if (err != NULL)
 			goto done;
 		/* Don't report size progress for an empty pack file. */
@@ -445,7 +445,7 @@ got_fetch_pack(struct got_object_id **pack_hash, struc
 		err = got_error_from_errno("dup");
 		goto done;
 	}
-	err = got_privsep_send_index_pack_req(&idxibuf, (*pack_hash)->sha1,
+	err = got_privsep_send_index_pack_req(&idxibuf, (*pack_hash)->hash,
 	    npackfd);
 	if (err != NULL)
 		goto done;
blob - 0762e831406c5e0e9f9e6eae03824defa43b6b00
blob + d698a2ced9897b6a0239e0a2db626ce0c5b11b14
--- lib/fileindex.c
+++ lib/fileindex.c
@@ -87,8 +87,8 @@ got_fileindex_perms_to_st(struct got_fileindex_entry *
 
 const struct got_error *
 got_fileindex_entry_update(struct got_fileindex_entry *ie,
-    int wt_fd, const char *ondisk_path, uint8_t *blob_sha1,
-    uint8_t *commit_sha1, int update_timestamps)
+    int wt_fd, const char *ondisk_path, uint8_t *blob_hash,
+    uint8_t *commit_hash, int update_timestamps)
 {
 	struct stat sb;
 
@@ -126,14 +126,14 @@ got_fileindex_entry_update(struct got_fileindex_entry 
 		}
 	}
 
-	if (blob_sha1) {
-		memcpy(ie->blob_sha1, blob_sha1, SHA1_DIGEST_LENGTH);
+	if (blob_hash) {
+		memcpy(ie->blob_hash, blob_hash, SHA1_DIGEST_LENGTH);
 		ie->flags &= ~GOT_FILEIDX_F_NO_BLOB;
 	} else
 		ie->flags |= GOT_FILEIDX_F_NO_BLOB;
 
-	if (commit_sha1) {
-		memcpy(ie->commit_sha1, commit_sha1, SHA1_DIGEST_LENGTH);
+	if (commit_hash) {
+		memcpy(ie->commit_hash, commit_hash, SHA1_DIGEST_LENGTH);
 		ie->flags &= ~GOT_FILEIDX_F_NO_COMMIT;
 	} else
 		ie->flags |= GOT_FILEIDX_F_NO_COMMIT;
@@ -451,13 +451,13 @@ write_fileindex_entry(SHA1_CTX *ctx, struct got_filein
 	if (err)
 		return err;
 
-	SHA1Update(ctx, ie->blob_sha1, SHA1_DIGEST_LENGTH);
-	n = fwrite(ie->blob_sha1, 1, SHA1_DIGEST_LENGTH, outfile);
+	SHA1Update(ctx, ie->blob_hash, SHA1_DIGEST_LENGTH);
+	n = fwrite(ie->blob_hash, 1, SHA1_DIGEST_LENGTH, outfile);
 	if (n != SHA1_DIGEST_LENGTH)
 		return got_ferror(outfile, GOT_ERR_IO);
 
-	SHA1Update(ctx, ie->commit_sha1, SHA1_DIGEST_LENGTH);
-	n = fwrite(ie->commit_sha1, 1, SHA1_DIGEST_LENGTH, outfile);
+	SHA1Update(ctx, ie->commit_hash, SHA1_DIGEST_LENGTH);
+	n = fwrite(ie->commit_hash, 1, SHA1_DIGEST_LENGTH, outfile);
 	if (n != SHA1_DIGEST_LENGTH)
 		return got_ferror(outfile, GOT_ERR_IO);
 
@@ -472,8 +472,8 @@ write_fileindex_entry(SHA1_CTX *ctx, struct got_filein
 	stage = got_fileindex_entry_stage_get(ie);
 	if (stage == GOT_FILEIDX_STAGE_MODIFY ||
 	    stage == GOT_FILEIDX_STAGE_ADD) {
-		SHA1Update(ctx, ie->staged_blob_sha1, SHA1_DIGEST_LENGTH);
-		n = fwrite(ie->staged_blob_sha1, 1, SHA1_DIGEST_LENGTH,
+		SHA1Update(ctx, ie->staged_blob_hash, SHA1_DIGEST_LENGTH);
+		n = fwrite(ie->staged_blob_hash, 1, SHA1_DIGEST_LENGTH,
 		    outfile);
 		if (n != SHA1_DIGEST_LENGTH)
 			return got_ferror(outfile, GOT_ERR_IO);
@@ -488,7 +488,7 @@ got_fileindex_write(struct got_fileindex *fileindex, F
 	const struct got_error *err = NULL;
 	struct got_fileindex_hdr hdr;
 	SHA1_CTX ctx;
-	uint8_t sha1[SHA1_DIGEST_LENGTH];
+	uint8_t hash[SHA1_DIGEST_LENGTH];
 	size_t n;
 	struct got_fileindex_entry *ie, *tmp;
 
@@ -524,9 +524,9 @@ got_fileindex_write(struct got_fileindex *fileindex, F
 			return err;
 	}
 
-	SHA1Final(sha1, &ctx);
-	n = fwrite(sha1, 1, sizeof(sha1), outfile);
-	if (n != sizeof(sha1))
+	SHA1Final(hash, &ctx);
+	n = fwrite(hash, 1, sizeof(hash), outfile);
+	if (n != sizeof(hash))
 		return got_ferror(outfile, GOT_ERR_IO);
 
 	if (fflush(outfile) != 0)
@@ -652,19 +652,19 @@ read_fileindex_entry(struct got_fileindex_entry **iep,
 	if (err)
 		goto done;
 
-	n = fread(ie->blob_sha1, 1, SHA1_DIGEST_LENGTH, infile);
+	n = fread(ie->blob_hash, 1, SHA1_DIGEST_LENGTH, infile);
 	if (n != SHA1_DIGEST_LENGTH) {
 		err = got_ferror(infile, GOT_ERR_FILEIDX_BAD);
 		goto done;
 	}
-	SHA1Update(ctx, ie->blob_sha1, SHA1_DIGEST_LENGTH);
+	SHA1Update(ctx, ie->blob_hash, SHA1_DIGEST_LENGTH);
 
-	n = fread(ie->commit_sha1, 1, SHA1_DIGEST_LENGTH, infile);
+	n = fread(ie->commit_hash, 1, SHA1_DIGEST_LENGTH, infile);
 	if (n != SHA1_DIGEST_LENGTH) {
 		err = got_ferror(infile, GOT_ERR_FILEIDX_BAD);
 		goto done;
 	}
-	SHA1Update(ctx, ie->commit_sha1, SHA1_DIGEST_LENGTH);
+	SHA1Update(ctx, ie->commit_hash, SHA1_DIGEST_LENGTH);
 
 	err = read_fileindex_val32(&ie->flags, ctx, infile);
 	if (err)
@@ -678,13 +678,13 @@ read_fileindex_entry(struct got_fileindex_entry **iep,
 		uint32_t stage = got_fileindex_entry_stage_get(ie);
 		if (stage == GOT_FILEIDX_STAGE_MODIFY ||
 		    stage == GOT_FILEIDX_STAGE_ADD) {
-			n = fread(ie->staged_blob_sha1, 1, SHA1_DIGEST_LENGTH,
+			n = fread(ie->staged_blob_hash, 1, SHA1_DIGEST_LENGTH,
 			    infile);
 			if (n != SHA1_DIGEST_LENGTH) {
 				err = got_ferror(infile, GOT_ERR_FILEIDX_BAD);
 				goto done;
 			}
-			SHA1Update(ctx, ie->staged_blob_sha1, SHA1_DIGEST_LENGTH);
+			SHA1Update(ctx, ie->staged_blob_hash, SHA1_DIGEST_LENGTH);
 		}
 	} else {
 		/* GOT_FILE_INDEX_VERSION 1 does not support staging. */
@@ -706,8 +706,8 @@ got_fileindex_read(struct got_fileindex *fileindex, FI
 	struct got_fileindex_hdr hdr;
 	SHA1_CTX ctx;
 	struct got_fileindex_entry *ie;
-	uint8_t sha1_expected[SHA1_DIGEST_LENGTH];
-	uint8_t sha1[SHA1_DIGEST_LENGTH];
+	uint8_t hash_expected[SHA1_DIGEST_LENGTH];
+	uint8_t hash[SHA1_DIGEST_LENGTH];
 	size_t n;
 	int i;
 
@@ -754,11 +754,11 @@ got_fileindex_read(struct got_fileindex *fileindex, FI
 			return err;
 	}
 
-	n = fread(sha1_expected, 1, sizeof(sha1_expected), infile);
-	if (n != sizeof(sha1_expected))
+	n = fread(hash_expected, 1, sizeof(hash_expected), infile);
+	if (n != sizeof(hash_expected))
 		return got_ferror(infile, GOT_ERR_FILEIDX_BAD);
-	SHA1Final(sha1, &ctx);
-	if (memcmp(sha1, sha1_expected, SHA1_DIGEST_LENGTH) != 0)
+	SHA1Final(hash, &ctx);
+	if (memcmp(hash, hash_expected, SHA1_DIGEST_LENGTH) != 0)
 		return got_error(GOT_ERR_FILEIDX_CSUM);
 
 	return NULL;
blob - 2575eb63d3f9bfe0cd35903ae30824124fa07ca8
blob + b7e5f1db5b6082c9d5b868be5712c8993c3689c3
--- lib/got_lib_deflate.h
+++ lib/got_lib_deflate.h
@@ -19,7 +19,7 @@ struct got_deflate_checksum {
 	uint32_t *output_crc;
 
 	/* If not NULL, mix output bytes into this SHA1 context. */
-	SHA1_CTX *output_sha1;
+	SHA1_CTX *output_hash;
 };
 
 struct got_deflate_buf {
blob - 0c22385de5665de7e4366e6db2b42d3737058e0f
blob + 6156c4d96c3ccb15cf30ce5f7236ae09586a6299
--- lib/got_lib_fileindex.h
+++ lib/got_lib_fileindex.h
@@ -47,10 +47,10 @@ struct got_fileindex_entry {
 #define GOT_FILEIDX_MODE_PERMS_SHIFT	4
 
 	/* SHA1 of corresponding blob in repository. */
-	uint8_t blob_sha1[SHA1_DIGEST_LENGTH];
+	uint8_t blob_hash[SHA1_DIGEST_LENGTH];
 
 	/* SHA1 of corresponding base commit in repository. */
-	uint8_t commit_sha1[SHA1_DIGEST_LENGTH];
+	uint8_t commit_hash[SHA1_DIGEST_LENGTH];
 
 	uint32_t flags;
 
@@ -66,7 +66,7 @@ struct got_fileindex_entry {
 	 * GOT_FILEIDX_STAGE_MODIFY or GOT_FILEIDX_STAGE_ADD.
 	 * Otherwise, this field is not written to disk.
 	 */
-	uint8_t staged_blob_sha1[SHA1_DIGEST_LENGTH];
+	uint8_t staged_blob_hash[SHA1_DIGEST_LENGTH];
 };
 
 /* Modifications explicitly staged for commit. */
@@ -100,7 +100,7 @@ struct got_fileindex_hdr {
 #define GOT_FILE_INDEX_VERSION	2
 	uint32_t nentries;	/* big-endian */
 	/* list of concatenated fileindex entries */
-	uint8_t sha1[SHA1_DIGEST_LENGTH]; /* checksum of above on-disk data */
+	uint8_t hash[SHA1_DIGEST_LENGTH]; /* checksum of above on-disk data */
 };
 
 mode_t got_fileindex_entry_perms_get(struct got_fileindex_entry *);
blob - 4ddc5aac63e46a5562147f8b561c4dea76cad65c
blob + 276955ef59f1f876bd0d16fd0ae8c624cbb843c0
--- lib/got_lib_inflate.h
+++ lib/got_lib_inflate.h
@@ -19,13 +19,13 @@ struct got_inflate_checksum {
 	uint32_t *input_crc;
 
 	/* If not NULL, mix input bytes into this SHA1 context. */
-	SHA1_CTX *input_sha1;
+	SHA1_CTX *input_hash;
 
 	/* If not NULL, mix output bytes into this CRC checksum. */
 	uint32_t *output_crc;
 
 	/* If not NULL, mix output bytes into this SHA1 context. */
-	SHA1_CTX *output_sha1;
+	SHA1_CTX *output_hash;
 };
 
 struct got_inflate_buf {
blob - 188c28e9e67bdc37146176e911d6226b223c40d2
blob + 3ca37674822674c80444158b4083d669c36da1d3
--- lib/got_lib_pack.h
+++ lib/got_lib_pack.h
@@ -63,12 +63,12 @@ const struct got_error *got_pack_parse_object_type_and
 /* See Documentation/technical/pack-format.txt in Git. */
 
 struct got_packidx_trailer {
-	u_int8_t	packfile_sha1[SHA1_DIGEST_LENGTH];
-	u_int8_t	packidx_sha1[SHA1_DIGEST_LENGTH];
+	u_int8_t	packfile_hash[SHA1_DIGEST_LENGTH];
+	u_int8_t	packidx_hash[SHA1_DIGEST_LENGTH];
 } __attribute__((__packed__));
 
 struct got_packidx_object_id {
-	u_int8_t sha1[SHA1_DIGEST_LENGTH];
+	u_int8_t hash[SHA1_DIGEST_LENGTH];
 } __attribute__((__packed__));
 
 /* Ignore pack index version 1 which is no longer written by Git. */
@@ -161,7 +161,7 @@ struct got_packfile_object_data {
 
 /* If object is of type	GOT_OBJ_TYPE_REF_DELTA. */
 struct got_packfile_object_data_ref_delta {
-	uint8_t sha1[SHA1_DIGEST_LENGTH];
+	uint8_t hash[SHA1_DIGEST_LENGTH];
 	uint8_t *delta_data;		/* compressed */
 };
 
blob - 7a3c6579c0c3c5ab813f5c5cdb1093a791ac08b4
blob + 11b6bffac63b1961d377105074c25ae65a3c23c2
--- lib/got_lib_pack_create.h
+++ lib/got_lib_pack_create.h
@@ -18,10 +18,10 @@
  * Write pack file data into the provided open packfile handle, for all
  * objects reachable via the commits listed in 'ours'.
  * Exclude any objects for commits listed in 'theirs' if 'theirs' is not NULL.
- * Return the SHA1 digest of the resulting pack file in pack_sha1 which must
+ * Return the SHA1 digest of the resulting pack file in pack_hash which must
  * be pre-allocated by the caller with at least SHA1_DIGEST_LENGTH bytes.
  */
-const struct got_error *got_pack_create(uint8_t *pack_sha1, int packfd,
+const struct got_error *got_pack_create(uint8_t *pack_hash, int packfd,
     FILE *delta_cache, struct got_object_id **theirs, int ntheirs,
     struct got_object_id **ours, int nours,
     struct got_repository *repo, int loose_obj_only, int allow_empty,
blob - bec94759fda7eb63db8c6a38520291cd5c1a8ad1
blob + f5f3787f6b9ced9b93f822891e4f84591d8faab5
--- lib/got_lib_pack_index.h
+++ lib/got_lib_pack_index.h
@@ -23,6 +23,6 @@ const struct got_error *got_pack_hwrite(int, void *, i
 const struct got_error *
 got_pack_index(struct got_pack *pack, int idxfd,
     FILE *tmpfile, FILE *delta_base_file, FILE *delta_accum_file,
-    uint8_t *pack_sha1_expected,
+    uint8_t *pack_hash_expected,
     got_pack_index_progress_cb progress_cb, void *progress_arg,
     struct got_ratelimit *rl);
blob - dc46eb047636a6ef075d902f58565030b486aa27
blob + 33354fbde43d41ee05a858a41337eaeba1639acb
--- lib/inflate.c
+++ lib/inflate.c
@@ -91,8 +91,8 @@ csum_input(struct got_inflate_checksum *csum, const ui
 	if (csum->input_crc)
 		*csum->input_crc = crc32(*csum->input_crc, buf, len);
 
-	if (csum->input_sha1)
-		SHA1Update(csum->input_sha1, buf, len);
+	if (csum->input_hash)
+		SHA1Update(csum->input_hash, buf, len);
 }
 
 static void
@@ -101,8 +101,8 @@ csum_output(struct got_inflate_checksum *csum, const u
 	if (csum->output_crc)
 		*csum->output_crc = crc32(*csum->output_crc, buf, len);
 
-	if (csum->output_sha1)
-		SHA1Update(csum->output_sha1, buf, len);
+	if (csum->output_hash)
+		SHA1Update(csum->output_hash, buf, len);
 }
 
 const struct got_error *
blob - 57876d8fb763d7736c0cb4fbb6967718793d2cea
blob + 87add3cc522abd473e4ce6fc913540428ddc058b
--- lib/object.c
+++ lib/object.c
@@ -115,7 +115,7 @@ got_object_get_path(char **path, struct got_object_id 
 		goto done;
 
 	if (asprintf(path, "%s/%.2x/%s", path_objects,
-	    id->sha1[0], hex + 2) == -1)
+	    id->hash[0], hex + 2) == -1)
 		err = got_error_from_errno("asprintf");
 
 done:
@@ -150,7 +150,7 @@ got_object_open_by_id_str(struct got_object **obj, str
 {
 	struct got_object_id id;
 
-	if (!got_parse_sha1_digest(id.sha1, id_str))
+	if (!got_parse_sha1_digest(id.hash, id_str))
 		return got_error_path(id_str, GOT_ERR_BAD_OBJ_ID_STR);
 
 	return got_object_open(obj, repo, &id);
blob - 8fa42a873d1dd3feb591275a17e1bd546c3dab59
blob + 602a0299443f4ab08a46d042143e10f8b8d2bba2
--- lib/object_create.c
+++ lib/object_create.c
@@ -125,14 +125,14 @@ got_object_blob_file_create(struct got_object_id **id,
 	char *header = NULL;
 	int fd = -1;
 	struct stat sb;
-	SHA1_CTX sha1_ctx;
+	SHA1_CTX hash_ctx;
 	size_t headerlen = 0, n;
 
 	*id = NULL;
 	*blobfile = NULL;
 	*blobsize = 0;
 
-	SHA1Init(&sha1_ctx);
+	SHA1Init(&hash_ctx);
 
 	fd = open(ondisk_path, O_RDONLY | O_NOFOLLOW | O_CLOEXEC);
 	if (fd == -1) {
@@ -154,7 +154,7 @@ got_object_blob_file_create(struct got_object_id **id,
 		goto done;
 	}
 	headerlen = strlen(header) + 1;
-	SHA1Update(&sha1_ctx, header, headerlen);
+	SHA1Update(&hash_ctx, header, headerlen);
 
 	*blobfile = got_opentemp();
 	if (*blobfile == NULL) {
@@ -187,7 +187,7 @@ got_object_blob_file_create(struct got_object_id **id,
 		}
 		if (inlen == 0)
 			break; /* EOF */
-		SHA1Update(&sha1_ctx, buf, inlen);
+		SHA1Update(&hash_ctx, buf, inlen);
 		n = fwrite(buf, 1, inlen, *blobfile);
 		if (n != inlen) {
 			err = got_ferror(*blobfile, GOT_ERR_IO);
@@ -203,7 +203,7 @@ got_object_blob_file_create(struct got_object_id **id,
 		err = got_error_from_errno("malloc");
 		goto done;
 	}
-	SHA1Final((*id)->sha1, &sha1_ctx);
+	SHA1Final((*id)->hash, &hash_ctx);
 
 	if (fflush(*blobfile) != 0) {
 		err = got_error_from_errno("fflush");
@@ -306,7 +306,7 @@ got_object_tree_create(struct got_object_id **id,
 {
 	const struct got_error *err = NULL;
 	char modebuf[sizeof("100644 ")];
-	SHA1_CTX sha1_ctx;
+	SHA1_CTX hash_ctx;
 	char *header = NULL;
 	size_t headerlen, len = 0, n;
 	FILE *treefile = NULL;
@@ -318,7 +318,7 @@ got_object_tree_create(struct got_object_id **id,
 
 	*id = NULL;
 
-	SHA1Init(&sha1_ctx);
+	SHA1Init(&hash_ctx);
 
 	sorted_entries = calloc(nentries, sizeof(struct got_tree_entry *));
 	if (sorted_entries == NULL)
@@ -344,7 +344,7 @@ got_object_tree_create(struct got_object_id **id,
 		goto done;
 	}
 	headerlen = strlen(header) + 1;
-	SHA1Update(&sha1_ctx, header, headerlen);
+	SHA1Update(&hash_ctx, header, headerlen);
 
 	treefile = got_opentemp();
 	if (treefile == NULL) {
@@ -370,7 +370,7 @@ got_object_tree_create(struct got_object_id **id,
 			err = got_ferror(treefile, GOT_ERR_IO);
 			goto done;
 		}
-		SHA1Update(&sha1_ctx, modebuf, len);
+		SHA1Update(&hash_ctx, modebuf, len);
 		treesize += n;
 
 		len = strlen(te->name) + 1; /* must include NUL */
@@ -379,16 +379,16 @@ got_object_tree_create(struct got_object_id **id,
 			err = got_ferror(treefile, GOT_ERR_IO);
 			goto done;
 		}
-		SHA1Update(&sha1_ctx, te->name, len);
+		SHA1Update(&hash_ctx, te->name, len);
 		treesize += n;
 
 		len = SHA1_DIGEST_LENGTH;
-		n = fwrite(te->id.sha1, 1, len, treefile);
+		n = fwrite(te->id.hash, 1, len, treefile);
 		if (n != len) {
 			err = got_ferror(treefile, GOT_ERR_IO);
 			goto done;
 		}
-		SHA1Update(&sha1_ctx, te->id.sha1, len);
+		SHA1Update(&hash_ctx, te->id.hash, len);
 		treesize += n;
 	}
 
@@ -397,7 +397,7 @@ got_object_tree_create(struct got_object_id **id,
 		err = got_error_from_errno("malloc");
 		goto done;
 	}
-	SHA1Final((*id)->sha1, &sha1_ctx);
+	SHA1Final((*id)->hash, &hash_ctx);
 
 	if (fflush(treefile) != 0) {
 		err = got_error_from_errno("fflush");
@@ -426,7 +426,7 @@ got_object_commit_create(struct got_object_id **id,
     const char *logmsg, struct got_repository *repo)
 {
 	const struct got_error *err = NULL;
-	SHA1_CTX sha1_ctx;
+	SHA1_CTX hash_ctx;
 	char *header = NULL, *tree_str = NULL;
 	char *author_str = NULL, *committer_str = NULL;
 	char *id_str = NULL;
@@ -438,7 +438,7 @@ got_object_commit_create(struct got_object_id **id,
 
 	*id = NULL;
 
-	SHA1Init(&sha1_ctx);
+	SHA1Init(&hash_ctx);
 
 	msg0 = strdup(logmsg);
 	if (msg0 == NULL)
@@ -477,7 +477,7 @@ got_object_commit_create(struct got_object_id **id,
 		goto done;
 	}
 	headerlen = strlen(header) + 1;
-	SHA1Update(&sha1_ctx, header, headerlen);
+	SHA1Update(&hash_ctx, header, headerlen);
 
 	commitfile = got_opentemp();
 	if (commitfile == NULL) {
@@ -501,7 +501,7 @@ got_object_commit_create(struct got_object_id **id,
 		goto done;
 	}
 	len = strlen(tree_str);
-	SHA1Update(&sha1_ctx, tree_str, len);
+	SHA1Update(&hash_ctx, tree_str, len);
 	n = fwrite(tree_str, 1, len, commitfile);
 	if (n != len) {
 		err = got_ferror(commitfile, GOT_ERR_IO);
@@ -524,7 +524,7 @@ got_object_commit_create(struct got_object_id **id,
 				goto done;
 			}
 			len = strlen(parent_str);
-			SHA1Update(&sha1_ctx, parent_str, len);
+			SHA1Update(&hash_ctx, parent_str, len);
 			n = fwrite(parent_str, 1, len, commitfile);
 			if (n != len) {
 				err = got_ferror(commitfile, GOT_ERR_IO);
@@ -539,7 +539,7 @@ got_object_commit_create(struct got_object_id **id,
 	}
 
 	len = strlen(author_str);
-	SHA1Update(&sha1_ctx, author_str, len);
+	SHA1Update(&hash_ctx, author_str, len);
 	n = fwrite(author_str, 1, len, commitfile);
 	if (n != len) {
 		err = got_ferror(commitfile, GOT_ERR_IO);
@@ -548,7 +548,7 @@ got_object_commit_create(struct got_object_id **id,
 	commitsize += n;
 
 	len = strlen(committer_str);
-	SHA1Update(&sha1_ctx, committer_str, len);
+	SHA1Update(&hash_ctx, committer_str, len);
 	n = fwrite(committer_str, 1, len, commitfile);
 	if (n != len) {
 		err = got_ferror(commitfile, GOT_ERR_IO);
@@ -556,7 +556,7 @@ got_object_commit_create(struct got_object_id **id,
 	}
 	commitsize += n;
 
-	SHA1Update(&sha1_ctx, "\n", 1);
+	SHA1Update(&hash_ctx, "\n", 1);
 	n = fwrite("\n", 1, 1, commitfile);
 	if (n != 1) {
 		err = got_ferror(commitfile, GOT_ERR_IO);
@@ -565,7 +565,7 @@ got_object_commit_create(struct got_object_id **id,
 	commitsize += n;
 
 	len = strlen(msg);
-	SHA1Update(&sha1_ctx, msg, len);
+	SHA1Update(&hash_ctx, msg, len);
 	n = fwrite(msg, 1, len, commitfile);
 	if (n != len) {
 		err = got_ferror(commitfile, GOT_ERR_IO);
@@ -573,7 +573,7 @@ got_object_commit_create(struct got_object_id **id,
 	}
 	commitsize += n;
 
-	SHA1Update(&sha1_ctx, "\n", 1);
+	SHA1Update(&hash_ctx, "\n", 1);
 	n = fwrite("\n", 1, 1, commitfile);
 	if (n != 1) {
 		err = got_ferror(commitfile, GOT_ERR_IO);
@@ -586,7 +586,7 @@ got_object_commit_create(struct got_object_id **id,
 		err = got_error_from_errno("malloc");
 		goto done;
 	}
-	SHA1Final((*id)->sha1, &sha1_ctx);
+	SHA1Final((*id)->hash, &hash_ctx);
 
 	if (fflush(commitfile) != 0) {
 		err = got_error_from_errno("fflush");
@@ -618,7 +618,7 @@ got_object_tag_create(struct got_object_id **id,
     struct got_repository *repo, int verbosity)
 {
 	const struct got_error *err = NULL;
-	SHA1_CTX sha1_ctx;
+	SHA1_CTX hash_ctx;
 	char *header = NULL;
 	char *tag_str = NULL, *tagger_str = NULL;
 	char *id_str = NULL, *obj_str = NULL, *type_str = NULL;
@@ -632,7 +632,7 @@ got_object_tag_create(struct got_object_id **id,
 
 	*id = NULL;
 
-	SHA1Init(&sha1_ctx);
+	SHA1Init(&hash_ctx);
 
 	err = got_object_id_str(&id_str, object_id);
 	if (err)
@@ -763,7 +763,7 @@ got_object_tag_create(struct got_object_id **id,
 	}
 
 	headerlen = strlen(header) + 1;
-	SHA1Update(&sha1_ctx, header, headerlen);
+	SHA1Update(&hash_ctx, header, headerlen);
 
 	tagfile = got_opentemp();
 	if (tagfile == NULL) {
@@ -778,7 +778,7 @@ got_object_tag_create(struct got_object_id **id,
 	}
 	tagsize += headerlen;
 	len = strlen(obj_str);
-	SHA1Update(&sha1_ctx, obj_str, len);
+	SHA1Update(&hash_ctx, obj_str, len);
 	n = fwrite(obj_str, 1, len, tagfile);
 	if (n != len) {
 		err = got_ferror(tagfile, GOT_ERR_IO);
@@ -786,7 +786,7 @@ got_object_tag_create(struct got_object_id **id,
 	}
 	tagsize += n;
 	len = strlen(type_str);
-	SHA1Update(&sha1_ctx, type_str, len);
+	SHA1Update(&hash_ctx, type_str, len);
 	n = fwrite(type_str, 1, len, tagfile);
 	if (n != len) {
 		err = got_ferror(tagfile, GOT_ERR_IO);
@@ -795,7 +795,7 @@ got_object_tag_create(struct got_object_id **id,
 	tagsize += n;
 
 	len = strlen(tag_str);
-	SHA1Update(&sha1_ctx, tag_str, len);
+	SHA1Update(&hash_ctx, tag_str, len);
 	n = fwrite(tag_str, 1, len, tagfile);
 	if (n != len) {
 		err = got_ferror(tagfile, GOT_ERR_IO);
@@ -804,7 +804,7 @@ got_object_tag_create(struct got_object_id **id,
 	tagsize += n;
 
 	len = strlen(tagger_str);
-	SHA1Update(&sha1_ctx, tagger_str, len);
+	SHA1Update(&hash_ctx, tagger_str, len);
 	n = fwrite(tagger_str, 1, len, tagfile);
 	if (n != len) {
 		err = got_ferror(tagfile, GOT_ERR_IO);
@@ -812,7 +812,7 @@ got_object_tag_create(struct got_object_id **id,
 	}
 	tagsize += n;
 
-	SHA1Update(&sha1_ctx, "\n", 1);
+	SHA1Update(&hash_ctx, "\n", 1);
 	n = fwrite("\n", 1, 1, tagfile);
 	if (n != 1) {
 		err = got_ferror(tagfile, GOT_ERR_IO);
@@ -821,7 +821,7 @@ got_object_tag_create(struct got_object_id **id,
 	tagsize += n;
 
 	len = strlen(msg);
-	SHA1Update(&sha1_ctx, msg, len);
+	SHA1Update(&hash_ctx, msg, len);
 	n = fwrite(msg, 1, len, tagfile);
 	if (n != len) {
 		err = got_ferror(tagfile, GOT_ERR_IO);
@@ -829,7 +829,7 @@ got_object_tag_create(struct got_object_id **id,
 	}
 	tagsize += n;
 
-	SHA1Update(&sha1_ctx, "\n", 1);
+	SHA1Update(&hash_ctx, "\n", 1);
 	n = fwrite("\n", 1, 1, tagfile);
 	if (n != 1) {
 		err = got_ferror(tagfile, GOT_ERR_IO);
@@ -839,7 +839,7 @@ got_object_tag_create(struct got_object_id **id,
 
 	if (signer_id && buf_len(buf) > 0) {
 		len = buf_len(buf);
-		SHA1Update(&sha1_ctx, buf_get(buf), len);
+		SHA1Update(&hash_ctx, buf_get(buf), len);
 		n = fwrite(buf_get(buf), 1, len, tagfile);
 		if (n != len) {
 			err = got_ferror(tagfile, GOT_ERR_IO);
@@ -853,7 +853,7 @@ got_object_tag_create(struct got_object_id **id,
 		err = got_error_from_errno("malloc");
 		goto done;
 	}
-	SHA1Final((*id)->sha1, &sha1_ctx);
+	SHA1Final((*id)->hash, &hash_ctx);
 
 	if (fflush(tagfile) != 0) {
 		err = got_error_from_errno("fflush");
blob - f58d1e7dc1d81be2989c4b8114725ca657c9ea3a
blob + 3a2d5a962ea374806ad2b70a660d0466c38b7615
--- lib/object_idset.c
+++ lib/object_idset.c
@@ -94,7 +94,7 @@ got_object_idset_free(struct got_object_idset *set)
 static uint64_t
 idset_hash(struct got_object_idset *set, struct got_object_id *id)
 {
-	return SipHash24(&set->key, id->sha1, sizeof(id->sha1));
+	return SipHash24(&set->key, id->hash, sizeof(id->hash));
 }
 
 static const struct got_error *
blob - 40afcdfffec70644278cf7d34e73724d4932e5ff
blob + ad79d81bee4c8f522e0068cf04aba9e4638c7fe3
--- lib/object_open_io.c
+++ lib/object_open_io.c
@@ -540,7 +540,7 @@ open_tree(struct got_tree_object **tree,
 			err = got_error(GOT_ERR_NO_SPACE);
 			goto done;
 		}
-		memcpy(te->id.sha1, pe->id, SHA1_DIGEST_LENGTH);
+		memcpy(te->id.hash, pe->id, SHA1_DIGEST_LENGTH);
 		te->mode = pe->mode;
 		te->idx = i;
 	}
blob - f80d86a8686711ff5888dd6847e0d84b98bc0672
blob + 9da64da69ffd4bc3a2b912a49a0eb2b9e2bb175d
--- lib/object_open_privsep.c
+++ lib/object_open_privsep.c
@@ -446,7 +446,7 @@ got_object_open(struct got_object **obj, struct got_re
 	if (err)
 		return err;
 
-	memcpy((*obj)->id.sha1, id->sha1, SHA1_DIGEST_LENGTH);
+	memcpy((*obj)->id.hash, id->hash, SHA1_DIGEST_LENGTH);
 
 	(*obj)->refcnt++;
 	return got_repo_cache_object(repo, id, *obj);
@@ -1013,7 +1013,7 @@ open_blob(struct got_blob_object **blob, struct got_re
 
 	(*blob)->hdrlen = hdrlen;
 	(*blob)->blocksize = blocksize;
-	memcpy(&(*blob)->id.sha1, id->sha1, SHA1_DIGEST_LENGTH);
+	memcpy(&(*blob)->id.hash, id->hash, SHA1_DIGEST_LENGTH);
 
 done:
 	free(path_packfile);
blob - 52fd48d81fd6b40f63ea1b5b40edbb3c8e40b3a2
blob + 41cc314e9780dbbce0599c51f52b164003522497
--- lib/object_parse.c
+++ lib/object_parse.c
@@ -71,7 +71,7 @@ int
 got_object_id_cmp(const struct got_object_id *id1,
     const struct got_object_id *id2)
 {
-	return memcmp(id1->sha1, id2->sha1, SHA1_DIGEST_LENGTH);
+	return memcmp(id1->hash, id2->hash, SHA1_DIGEST_LENGTH);
 }
 
 const struct got_error *
@@ -342,7 +342,7 @@ got_object_read_raw(uint8_t **outbuf, off_t *size, siz
 	}
 
 	SHA1Final(sha1, &sha1_ctx);
-	if (memcmp(expected_id->sha1, sha1, SHA1_DIGEST_LENGTH) != 0) {
+	if (memcmp(expected_id->hash, sha1, SHA1_DIGEST_LENGTH) != 0) {
 		err = got_error_checksum(expected_id);
 		goto done;
 	}
@@ -386,7 +386,7 @@ got_object_commit_add_parent(struct got_commit_object 
 	if (err)
 		return err;
 
-	if (!got_parse_sha1_digest(qid->id.sha1, id_str)) {
+	if (!got_parse_sha1_digest(qid->id.hash, id_str)) {
 		err = got_error(GOT_ERR_BAD_OBJ_DATA);
 		got_object_qid_free(qid);
 		return err;
@@ -638,7 +638,7 @@ got_object_parse_commit(struct got_commit_object **com
 			goto done;
 		}
 		s += label_len;
-		if (!got_parse_sha1_digest((*commit)->tree_id->sha1, s)) {
+		if (!got_parse_sha1_digest((*commit)->tree_id->hash, s)) {
 			err = got_error(GOT_ERR_BAD_OBJ_DATA);
 			goto done;
 		}
@@ -752,15 +752,15 @@ got_object_read_commit(struct got_commit_object **comm
 	SHA1_CTX sha1_ctx;
 	struct got_object_id id;
 
-	SHA1Init(&sha1_ctx);
+	SHA1Init(&hash_ctx);
 	memset(&csum, 0, sizeof(csum));
-	csum.output_sha1 = &sha1_ctx;
+	csum.output_hash = &hash_ctx;
 
 	err = got_inflate_to_mem_fd(&p, &len, NULL, &csum, expected_size, fd);
 	if (err)
 		return err;
 
-	SHA1Final(id.sha1, &sha1_ctx);
+	SHA1Final(id.hash, &sha1_ctx);
 	if (got_object_id_cmp(expected_id, &id) != 0) {
 		err = got_error_checksum(expected_id);
 		goto done;
@@ -929,7 +929,7 @@ got_object_read_tree(struct got_parsed_tree_entry **en
 	if (err)
 		return err;
 
-	SHA1Final(id.sha1, &sha1_ctx);
+	SHA1Final(id.hash, &sha1_ctx);
 	if (got_object_id_cmp(expected_id, &id) != 0) {
 		err = got_error_checksum(expected_id);
 		goto done;
@@ -992,7 +992,7 @@ got_object_parse_tag(struct got_tag_object **tag, uint
 			goto done;
 		}
 		s += label_len;
-		if (!got_parse_sha1_digest((*tag)->id.sha1, s)) {
+		if (!got_parse_sha1_digest((*tag)->id.hash, s)) {
 			err = got_error(GOT_ERR_BAD_OBJ_DATA);
 			goto done;
 		}
@@ -1169,7 +1169,7 @@ got_object_read_tag(struct got_tag_object **tag, int f
 	if (err)
 		return err;
 
-	SHA1Final(id.sha1, &sha1_ctx);
+	SHA1Final(id.hash, &sha1_ctx);
 	if (got_object_id_cmp(expected_id, &id) != 0) {
 		err = got_error_checksum(expected_id);
 		goto done;
blob - 68de5bf9f8523cf07c88e05955ce9b4c6abc451a
blob + 25dd12c77e6cfd60bf31d8234c00ce4e4827b99c
--- lib/pack.c
+++ lib/pack.c
@@ -75,7 +75,7 @@ got_packidx_init_hdr(struct got_packidx *p, int verify
 	const struct got_error *err = NULL;
 	struct got_packidx_v2_hdr *h;
 	SHA1_CTX ctx;
-	uint8_t sha1[SHA1_DIGEST_LENGTH];
+	uint8_t hash[SHA1_DIGEST_LENGTH];
 	size_t nobj, len_fanout, len_ids, offset, remain;
 	ssize_t n;
 	int i;
@@ -324,9 +324,9 @@ checksum:
 		}
 	}
 	if (verify) {
-		SHA1Update(&ctx, h->trailer->packfile_sha1, SHA1_DIGEST_LENGTH);
-		SHA1Final(sha1, &ctx);
-		if (memcmp(h->trailer->packidx_sha1, sha1,
+		SHA1Update(&ctx, h->trailer->packfile_hash, SHA1_DIGEST_LENGTH);
+		SHA1Final(hash, &ctx);
+		if (memcmp(h->trailer->packidx_hash, hash,
 		    SHA1_DIGEST_LENGTH) != 0)
 			err = got_error(GOT_ERR_PACKIDX_CSUM);
 	}
@@ -488,7 +488,7 @@ int
 got_packidx_get_object_idx(struct got_packidx *packidx,
     struct got_object_id *id)
 {
-	u_int8_t id0 = id->sha1[0];
+	u_int8_t id0 = id->hash[0];
 	uint32_t totobj = be32toh(packidx->hdr.fanout_table[0xff]);
 	int left = 0, right = totobj - 1;
 
@@ -501,7 +501,7 @@ got_packidx_get_object_idx(struct got_packidx *packidx
 
 		i = ((left + right) / 2);
 		oid = &packidx->hdr.sorted_ids[i];
-		cmp = memcmp(id->sha1, oid->sha1, SHA1_DIGEST_LENGTH);
+		cmp = memcmp(id->hash, oid->hash, SHA1_DIGEST_LENGTH);
 		if (cmp == 0)
 			return i;
 		else if (cmp > 0)
@@ -657,7 +657,7 @@ got_packidx_get_object_id(struct got_object_id *id,
 		return got_error(GOT_ERR_NO_OBJ);
 
 	oid = &packidx->hdr.sorted_ids[idx];
-	memcpy(id->sha1, oid->sha1, SHA1_DIGEST_LENGTH);
+	memcpy(id->hash, oid->hash, SHA1_DIGEST_LENGTH);
 	return NULL;
 }
 
@@ -687,12 +687,12 @@ got_packidx_match_id_str_prefix(struct got_object_id_q
 	if (id0 > 0)
 		i = be32toh(packidx->hdr.fanout_table[id0 - 1]);
 	oid = &packidx->hdr.sorted_ids[i];
-	while (i < totobj && oid->sha1[0] == id0) {
+	while (i < totobj && oid->hash[0] == id0) {
 		char id_str[SHA1_DIGEST_STRING_LENGTH];
 		struct got_object_qid *qid;
 		int cmp;
 
-		if (!got_sha1_digest_to_str(oid->sha1, id_str, sizeof(id_str)))
+		if (!got_sha1_digest_to_str(oid->hash, id_str, sizeof(id_str)))
 		        return got_error(GOT_ERR_NO_SPACE);
 
 		cmp = strncmp(id_str, id_str_prefix, prefix_len);
@@ -705,7 +705,7 @@ got_packidx_match_id_str_prefix(struct got_object_id_q
 		err = got_object_qid_alloc_partial(&qid);
 		if (err)
 			break;
-		memcpy(qid->id.sha1, oid->sha1, SHA1_DIGEST_LENGTH);
+		memcpy(qid->id.hash, oid->hash, SHA1_DIGEST_LENGTH);
 		STAILQ_INSERT_TAIL(matched_ids, qid, entry);
 
 		oid = &packidx->hdr.sorted_ids[++i];
blob - 0dda4f95f2b3f8b16523c768cd55fa04de120f90
blob + 54824509617d31f3a5ee2c6a5c913b0776f7945f
--- lib/pack_create.c
+++ lib/pack_create.c
@@ -1576,11 +1576,11 @@ deltahdr(off_t *packfile_size, SHA1_CTX *ctx, int pack
 		if (err)
 			return err;
 		*packfile_size += nh;
-		err = hwrite(packfd, m->prev->id.sha1,
-		    sizeof(m->prev->id.sha1), ctx);
+		err = hwrite(packfd, m->prev->id.hash,
+		    sizeof(m->prev->id.hash), ctx);
 		if (err)
 			return err;
-		*packfile_size += sizeof(m->prev->id.sha1);
+		*packfile_size += sizeof(m->prev->id.hash);
 	}
 
 	return NULL;
@@ -1599,7 +1599,7 @@ write_packed_object(off_t *packfile_size, int packfd,
 	struct got_raw_object *raw = NULL;
 	off_t outlen, delta_offset;
 
-	csum.output_sha1 = ctx;
+	csum.output_hash = ctx;
 	csum.output_crc = NULL;
 
 	if (m->reused_delta_offset)
@@ -1682,7 +1682,7 @@ done:
 }
 
 static const struct got_error *
-genpack(uint8_t *pack_sha1, int packfd, struct got_pack *reuse_pack,
+genpack(uint8_t *pack_hash, int packfd, struct got_pack *reuse_pack,
     FILE *delta_cache, struct got_pack_meta **deltify, int ndeltify,
     struct got_pack_meta **reuse, int nreuse,
     int ncolored, int nfound, int ntrees, int nours,
@@ -1784,8 +1784,8 @@ genpack(uint8_t *pack_sha1, int packfd, struct got_pac
 			goto done;
 	}
 
-	SHA1Final(pack_sha1, &ctx);
-	err = got_poll_write_full(packfd, pack_sha1, SHA1_DIGEST_LENGTH);
+	SHA1Final(pack_hash, &ctx);
+	err = got_poll_write_full(packfd, pack_hash, SHA1_DIGEST_LENGTH);
 	if (err)
 		goto done;
 	packfile_size += SHA1_DIGEST_LENGTH;
@@ -1822,7 +1822,7 @@ add_meta_idset_cb(struct got_object_id *id, void *data
 }
 
 const struct got_error *
-got_pack_create(uint8_t *packsha1, int packfd, FILE *delta_cache,
+got_pack_create(uint8_t *packhash, int packfd, FILE *delta_cache,
     struct got_object_id **theirs, int ntheirs,
     struct got_object_id **ours, int nours,
     struct got_repository *repo, int loose_obj_only, int allow_empty,
@@ -1931,7 +1931,7 @@ got_pack_create(uint8_t *packsha1, int packfd, FILE *d
 			goto done;
 	}
 
-	err = genpack(packsha1, packfd, reuse_pack, delta_cache, deltify.meta,
+	err = genpack(packhash, packfd, reuse_pack, delta_cache, deltify.meta,
 	    deltify.nmeta, reuse.meta, reuse.nmeta, ncolored, nfound, ntrees,
 	    nours, repo, progress_cb, progress_arg, rl,
 	    cancel_cb, cancel_arg);
blob - dbd1daa943f326573aefc06b1316d88bee4e852a
blob + 8ce03734c547cced2d00a7dca6105b30107b8f27
--- lib/pack_index.c
+++ lib/pack_index.c
@@ -129,7 +129,7 @@ get_obj_type_label(const char **label, int obj_type)
 }
 
 static const struct got_error *
-read_checksum(uint32_t *crc, SHA1_CTX *sha1_ctx, int fd, size_t len)
+read_checksum(uint32_t *crc, SHA1_CTX *hash_ctx, int fd, size_t len)
 {
 	uint8_t buf[8192];
 	size_t n;
@@ -143,15 +143,15 @@ read_checksum(uint32_t *crc, SHA1_CTX *sha1_ctx, int f
 			break;
 		if (crc)
 			*crc = crc32(*crc, buf, r);
-		if (sha1_ctx)
-			SHA1Update(sha1_ctx, buf, r);
+		if (hash_ctx)
+			SHA1Update(hash_ctx, buf, r);
 	}
 
 	return NULL;
 }
 
 static const struct got_error *
-read_file_sha1(SHA1_CTX *ctx, FILE *f, size_t len)
+read_file_hash(SHA1_CTX *ctx, FILE *f, size_t len)
 {
 	uint8_t buf[8192];
 	size_t n, r;
@@ -252,7 +252,7 @@ read_packed_object(struct got_pack *pack, struct got_i
 		headerlen = strlen(header) + 1;
 		SHA1Update(&ctx, header, headerlen);
 		if (obj->size > GOT_DELTA_RESULT_SIZE_CACHED_MAX) {
-			err = read_file_sha1(&ctx, tmpfile, datalen);
+			err = read_file_hash(&ctx, tmpfile, datalen);
 			if (err) {
 				free(header);
 				free(data);
@@ -260,12 +260,12 @@ read_packed_object(struct got_pack *pack, struct got_i
 			}
 		} else
 			SHA1Update(&ctx, data, datalen);
-		SHA1Final(obj->id.sha1, &ctx);
+		SHA1Final(obj->id.hash, &ctx);
 		free(header);
 		free(data);
 		break;
 	case GOT_OBJ_TYPE_REF_DELTA:
-		memset(obj->id.sha1, 0xff, SHA1_DIGEST_LENGTH);
+		memset(obj->id.hash, 0xff, SHA1_DIGEST_LENGTH);
 		if (pack->map) {
 			if (mapoff + SHA1_DIGEST_LENGTH >= pack->filesize) {
 				err = got_error(GOT_ERR_BAD_PACKFILE);
@@ -277,7 +277,7 @@ read_packed_object(struct got_pack *pack, struct got_i
 				    (long long)mapoff + SHA1_DIGEST_LENGTH);
 				break;
 			}
-			memcpy(obj->delta.ref.ref_id.sha1, pack->map + mapoff,
+			memcpy(obj->delta.ref.ref_id.hash, pack->map + mapoff,
 			    SHA1_DIGEST_LENGTH);
 			obj->crc = crc32(obj->crc, pack->map + mapoff,
 			    SHA1_DIGEST_LENGTH);
@@ -290,7 +290,7 @@ read_packed_object(struct got_pack *pack, struct got_i
 			if (err)
 				break;
 		} else {
-			n = read(pack->fd, obj->delta.ref.ref_id.sha1,
+			n = read(pack->fd, obj->delta.ref.ref_id.hash,
 			    SHA1_DIGEST_LENGTH);
 			if (n == -1) {
 				err = got_error_from_errno("read");
@@ -300,9 +300,9 @@ read_packed_object(struct got_pack *pack, struct got_i
 				err = got_error(GOT_ERR_BAD_PACKFILE);
 				break;
 			}
-			obj->crc = crc32(obj->crc, obj->delta.ref.ref_id.sha1,
+			obj->crc = crc32(obj->crc, obj->delta.ref.ref_id.hash,
 			    SHA1_DIGEST_LENGTH);
-			SHA1Update(pack_sha1_ctx, obj->delta.ref.ref_id.sha1,
+			SHA1Update(pack_sha1_ctx, obj->delta.ref.ref_id.hash,
 			    SHA1_DIGEST_LENGTH);
 			err = got_inflate_to_mem_fd(NULL, &datalen, &obj->len,
 			    &csum, obj->size, pack->fd);
@@ -312,7 +312,7 @@ read_packed_object(struct got_pack *pack, struct got_i
 		obj->len += SHA1_DIGEST_LENGTH;
 		break;
 	case GOT_OBJ_TYPE_OFFSET_DELTA:
-		memset(obj->id.sha1, 0xff, SHA1_DIGEST_LENGTH);
+		memset(obj->id.hash, 0xff, SHA1_DIGEST_LENGTH);
 		err = got_pack_parse_offset_delta(&obj->delta.ofs.base_offset,
 		    &obj->delta.ofs.base_offsetlen, pack, obj->off,
 		    obj->tslen);
@@ -448,12 +448,12 @@ resolve_deltified_object(struct got_pack *pack, struct
 	SHA1Init(&ctx);
 	SHA1Update(&ctx, header, headerlen);
 	if (max_size > GOT_DELTA_RESULT_SIZE_CACHED_MAX) {
-		err = read_file_sha1(&ctx, tmpfile, len);
+		err = read_file_hash(&ctx, tmpfile, len);
 		if (err)
 			goto done;
 	} else
 		SHA1Update(&ctx, buf, len);
-	SHA1Final(obj->id.sha1, &ctx);
+	SHA1Final(obj->id.hash, &ctx);
 done:
 	free(buf);
 	free(header);
@@ -467,9 +467,9 @@ done:
 
 /* Determine the slot in the pack index a given object ID should use. */
 static int
-find_object_idx(struct got_packidx *packidx, uint8_t *sha1)
+find_object_idx(struct got_packidx *packidx, uint8_t *hash)
 {
-	u_int8_t id0 = sha1[0];
+	u_int8_t id0 = hash[0];
 	uint32_t nindexed = be32toh(packidx->hdr.fanout_table[0xff]);
 	int left = 0, right = nindexed - 1;
 	int cmp = 0, i = 0;
@@ -483,7 +483,7 @@ find_object_idx(struct got_packidx *packidx, uint8_t *
 		i = ((left + right) / 2);
 		oid = &packidx->hdr.sorted_ids[i];
 
-		cmp = memcmp(sha1, oid->sha1, SHA1_DIGEST_LENGTH);
+		cmp = memcmp(hash, oid->hash, SHA1_DIGEST_LENGTH);
 		if (cmp == 0)
 			return -1; /* object already indexed */
 		else if (cmp > 0)
@@ -505,7 +505,7 @@ print_packidx(struct got_packidx *packidx)
 	fprintf(stderr, "object IDs:\n");
 	for (i = 0; i < nindexed; i++) {
 		char hex[SHA1_DIGEST_STRING_LENGTH];
-		got_sha1_digest_to_str(packidx->hdr.sorted_ids[i].sha1,
+		got_sha1_digest_to_str(packidx->hdr.sorted_ids[i].hash,
 		    hex, sizeof(hex));
 		fprintf(stderr, "%s\n", hex);
 	}
@@ -536,7 +536,7 @@ add_indexed_object(struct got_packidx *packidx, uint32
 {
 	int i;
 
-	memcpy(packidx->hdr.sorted_ids[idx].sha1, obj->id.sha1,
+	memcpy(packidx->hdr.sorted_ids[idx].hash, obj->id.hash,
 	    SHA1_DIGEST_LENGTH);
 	packidx->hdr.crc32[idx] = htobe32(obj->crc);
 	if (obj->off < GOT_PACKIDX_OFFSET_VAL_IS_LARGE_IDX)
@@ -549,7 +549,7 @@ add_indexed_object(struct got_packidx *packidx, uint32
 		packidx->nlargeobj++;
 	}
 
-	for (i = obj->id.sha1[0]; i <= 0xff; i++) {
+	for (i = obj->id.hash[0]; i <= 0xff; i++) {
 		uint32_t n = be32toh(packidx->hdr.fanout_table[i]);
 		packidx->hdr.fanout_table[i] = htobe32(n + 1);
 	}
@@ -627,7 +627,7 @@ report_progress(uint32_t nobj_total, uint32_t nobj_ind
 
 const struct got_error *
 got_pack_index(struct got_pack *pack, int idxfd, FILE *tmpfile,
-    FILE *delta_base_file, FILE *delta_accum_file, uint8_t *pack_sha1_expected,
+    FILE *delta_base_file, FILE *delta_accum_file, uint8_t *pack_hash_expected,
     got_pack_index_progress_cb progress_cb, void *progress_arg,
     struct got_ratelimit *rl)
 {
@@ -635,7 +635,7 @@ got_pack_index(struct got_pack *pack, int idxfd, FILE 
 	struct got_packfile_hdr hdr;
 	struct got_packidx packidx;
 	char buf[8];
-	char pack_sha1[SHA1_DIGEST_LENGTH];
+	char pack_hash[SHA1_DIGEST_LENGTH];
 	uint32_t nobj, nvalid, nloose, nresolved = 0, i;
 	struct got_indexed_object *objects = NULL, *obj;
 	SHA1_CTX ctx;
@@ -799,9 +799,9 @@ got_pack_index(struct got_pack *pack, int idxfd, FILE 
 	 * Having done a full pass over the pack file and can now
 	 * verify its checksum.
 	 */
-	SHA1Final(pack_sha1, &ctx);
+	SHA1Final(pack_hash, &ctx);
 
-	if (memcmp(pack_sha1_expected, pack_sha1, SHA1_DIGEST_LENGTH) != 0) {
+	if (memcmp(pack_hash_expected, pack_hash, SHA1_DIGEST_LENGTH) != 0) {
 		err = got_error(GOT_ERR_PACKFILE_CSUM);
 		goto done;
 	}
@@ -815,7 +815,7 @@ got_pack_index(struct got_pack *pack, int idxfd, FILE 
 			goto done;
 		}
 
-		memcpy(pack_sha1_expected, pack->map +
+		memcpy(pack_hash_expected, pack->map +
 		    pack->filesize - SHA1_DIGEST_LENGTH,
 		    SHA1_DIGEST_LENGTH);
 	} else {
@@ -824,7 +824,7 @@ got_pack_index(struct got_pack *pack, int idxfd, FILE 
 			err = got_error_from_errno("lseek");
 			goto done;
 		}
-		n = read(pack->fd, pack_sha1_expected, SHA1_DIGEST_LENGTH);
+		n = read(pack->fd, pack_hash_expected, SHA1_DIGEST_LENGTH);
 		if (n == -1) {
 			err = got_error_from_errno("read");
 			goto done;
@@ -834,7 +834,7 @@ got_pack_index(struct got_pack *pack, int idxfd, FILE 
 			goto done;
 		}
 	}
-	if (memcmp(pack_sha1, pack_sha1_expected, SHA1_DIGEST_LENGTH) != 0) {
+	if (memcmp(pack_hash, pack_hash_expected, SHA1_DIGEST_LENGTH) != 0) {
 		err = got_error_msg(GOT_ERR_BAD_PACKFILE,
 		    "bad checksum in pack file trailer");
 		goto done;
@@ -962,7 +962,7 @@ got_pack_index(struct got_pack *pack, int idxfd, FILE 
 		if (err)
 			goto done;
 	}
-	err = got_pack_hwrite(idxfd, pack_sha1, SHA1_DIGEST_LENGTH, &ctx);
+	err = got_pack_hwrite(idxfd, pack_hash, SHA1_DIGEST_LENGTH, &ctx);
 	if (err)
 		goto done;
 
blob - 6227992d23f21048e0238cc7a3bfe018b85c9cf5
blob + 759d146cf9afa72806ed93656441706e3bc78105
--- lib/patch.c
+++ lib/patch.c
@@ -705,7 +705,7 @@ open_blob(char **path, FILE **fp, const char *blobid,
 			return err;
 		idptr = matched_id;
 	} else {
-		if (!got_parse_sha1_digest(id.sha1, blobid))
+		if (!got_parse_sha1_digest(id.hash, blobid))
 			return got_error(GOT_ERR_BAD_OBJ_ID_STR);
 		idptr = &id;
 	}
@@ -770,8 +770,8 @@ prepare_merge(int *do_merge, char **apath, FILE **afil
 		err = got_object_tree_find_path(&id, NULL, repo, tree, path);
 		if (err)
 			return err;
-		got_sha1_digest_to_str(id->sha1, p->blob, sizeof(p->blob));
-		got_sha1_digest_to_str(commit_id->sha1, p->cid, sizeof(p->cid));
+		got_sha1_digest_to_str(id->hash, p->blob, sizeof(p->blob));
+		got_sha1_digest_to_str(commit_id->hash, p->cid, sizeof(p->cid));
 		free(id);
 		err = open_blob(apath, afile, p->blob, repo);
 		*do_merge = err == NULL;
blob - a54ba7c0e2d8f3fc5ac97dacc39c1d54cb028eb7
blob + b85b1a7e65489e1c22483a74c27de91855799e9d
--- lib/privsep.c
+++ lib/privsep.c
@@ -658,7 +658,7 @@ got_privsep_send_fetch_outfd(struct imsgbuf *ibuf, int
 const struct got_error *
 got_privsep_recv_fetch_progress(int *done, struct got_object_id **id,
     char **refname, struct got_pathlist_head *symrefs, char **server_progress,
-    off_t *packfile_size, uint8_t *pack_sha1, struct imsgbuf *ibuf)
+    off_t *packfile_size, uint8_t *pack_hash, struct imsgbuf *ibuf)
 {
 	const struct got_error *err = NULL;
 	struct imsg imsg;
@@ -673,7 +673,7 @@ got_privsep_recv_fetch_progress(int *done, struct got_
 	*refname = NULL;
 	*server_progress = NULL;
 	*packfile_size = 0;
-	memset(pack_sha1, 0, SHA1_DIGEST_LENGTH);
+	memset(pack_hash, 0, SHA1_DIGEST_LENGTH);
 
 	err = got_privsep_recv_imsg(&imsg, ibuf, 0);
 	if (err)
@@ -785,7 +785,7 @@ got_privsep_recv_fetch_progress(int *done, struct got_
 			err = got_error(GOT_ERR_PRIVSEP_MSG);
 			break;
 		}
-		memcpy(pack_sha1, imsg.data, SHA1_DIGEST_LENGTH);
+		memcpy(pack_hash, imsg.data, SHA1_DIGEST_LENGTH);
 		*done = 1;
 		break;
 	default:
@@ -1026,14 +1026,14 @@ got_privsep_recv_send_progress(int *done, off_t *bytes
 }
 
 const struct got_error *
-got_privsep_send_index_pack_req(struct imsgbuf *ibuf, uint8_t *pack_sha1,
+got_privsep_send_index_pack_req(struct imsgbuf *ibuf, uint8_t *pack_hash,
     int fd)
 {
 	const struct got_error *err = NULL;
 
 	/* Keep in sync with struct got_imsg_index_pack_request */
 	if (imsg_compose(ibuf, GOT_IMSG_IDXPACK_REQUEST, 0, 0, fd,
-	    pack_sha1, SHA1_DIGEST_LENGTH) == -1) {
+	    pack_hash, SHA1_DIGEST_LENGTH) == -1) {
 		err = got_error_from_errno("imsg_compose INDEX_REQUEST");
 		close(fd);
 		return err;
@@ -1533,7 +1533,7 @@ recv_tree_entries(void *data, size_t datalen, struct g
 		te_name = buf + sizeof(ite);
 		memcpy(te->name, te_name, ite.namelen);
 		te->name[ite.namelen] = '\0';
-		memcpy(te->id.sha1, ite.id, SHA1_DIGEST_LENGTH);
+		memcpy(te->id.hash, ite.id, SHA1_DIGEST_LENGTH);
 		te->mode = ite.mode;
 		te->idx = *nentries;
 		(*nentries)++;
@@ -1767,7 +1767,7 @@ got_privsep_send_tag(struct imsgbuf *ibuf, struct got_
 		return got_error_from_errno("malloc");
 
 	itag = (struct got_imsg_tag_object *)buf;
-	memcpy(itag->id, tag->id.sha1, sizeof(itag->id));
+	memcpy(itag->id, tag->id.hash, sizeof(itag->id));
 	itag->obj_type = tag->obj_type;
 	itag->tag_len = tag_len;
 	itag->tagger_len = tagger_len;
@@ -1838,7 +1838,7 @@ got_privsep_recv_tag(struct got_tag_object **tag, stru
 			break;
 		}
 
-		memcpy((*tag)->id.sha1, itag->id, SHA1_DIGEST_LENGTH);
+		memcpy((*tag)->id.hash, itag->id, SHA1_DIGEST_LENGTH);
 
 		(*tag)->tag = strndup(imsg.data + len, itag->tag_len);
 		if ((*tag)->tag == NULL) {
@@ -2576,7 +2576,7 @@ got_privsep_send_commit_traversal_request(struct imsgb
 	if (wbuf == NULL)
 		return got_error_from_errno(
 		    "imsg_create COMMIT_TRAVERSAL_REQUEST");
-	if (imsg_add(wbuf, id->sha1, SHA1_DIGEST_LENGTH) == -1)
+	if (imsg_add(wbuf, id->hash, SHA1_DIGEST_LENGTH) == -1)
 		return got_error_from_errno("imsg_add "
 		    "COMMIT_TRAVERSAL_REQUEST");
 	if (imsg_add(wbuf, &idx, sizeof(idx)) == -1)
@@ -2622,12 +2622,12 @@ got_privsep_recv_traversed_commits(struct got_commit_o
 			}
 			for (i = 0; i < icommits->ncommits; i++) {
 				struct got_object_qid *qid;
-				uint8_t *sha1 = (uint8_t *)imsg.data +
+				uint8_t *hash = (uint8_t *)imsg.data +
 				    sizeof(*icommits) + i * SHA1_DIGEST_LENGTH;
 				err = got_object_qid_alloc_partial(&qid);
 				if (err)
 					break;
-				memcpy(qid->id.sha1, sha1, SHA1_DIGEST_LENGTH);
+				memcpy(qid->id.hash, hash, SHA1_DIGEST_LENGTH);
 				STAILQ_INSERT_TAIL(commit_ids, qid, entry);
 
 				/* The last commit may contain a change. */
@@ -2683,7 +2683,7 @@ got_privsep_send_enumerated_tree(size_t *totlen, struc
 	if (wbuf == NULL)
 		return got_error_from_errno("imsg_create ENUMERATED_TREE");
 
-	if (imsg_add(wbuf, tree_id->sha1, SHA1_DIGEST_LENGTH) == -1)
+	if (imsg_add(wbuf, tree_id->hash, SHA1_DIGEST_LENGTH) == -1)
 		return got_error_from_errno("imsg_add ENUMERATED_TREE");
 	if (imsg_add(wbuf, &nentries, sizeof(nentries)) == -1)
 		return got_error_from_errno("imsg_add ENUMERATED_TREE");
@@ -2799,7 +2799,7 @@ got_privsep_recv_enumerated_objects(int *found_all_obj
 				break;
 			}
 			icommit = (struct got_imsg_enumerated_commit *)imsg.data;
-			memcpy(commit_id.sha1, icommit->id, SHA1_DIGEST_LENGTH);
+			memcpy(commit_id.hash, icommit->id, SHA1_DIGEST_LENGTH);
 			mtime = icommit->mtime;
 			have_commit = 1;
 			break;
@@ -2819,7 +2819,7 @@ got_privsep_recv_enumerated_objects(int *found_all_obj
 				err = got_error(GOT_ERR_PRIVSEP_LEN);
 				break;
 			}
-			memcpy(tree_id.sha1, itree->id, sizeof(tree_id.sha1));
+			memcpy(tree_id.hash, itree->id, sizeof(tree_id.hash));
 			free(path);
 			path = strndup(imsg.data + sizeof(*itree), path_len);
 			if (path == NULL) {
@@ -3301,7 +3301,7 @@ got_privsep_send_painting_request(struct imsgbuf *ibuf
 	struct got_imsg_commit_painting_request ireq;
 
 	memset(&ireq, 0, sizeof(ireq));
-	memcpy(ireq.id, id->sha1, sizeof(ireq.id));
+	memcpy(ireq.id, id->hash, sizeof(ireq.id));
 	ireq.idx = idx;
 	ireq.color = color;
 
@@ -3348,7 +3348,7 @@ send_painted_commits(struct got_object_id_queue *ids, 
 		color = (intptr_t)qid->data;
 
 		/* Keep in sync with struct got_imsg_painted_commit! */
-		if (imsg_add(wbuf, qid->id.sha1, SHA1_DIGEST_LENGTH) == -1)
+		if (imsg_add(wbuf, qid->id.hash, SHA1_DIGEST_LENGTH) == -1)
 			return got_error_from_errno("imsg_add PAINTED_COMMITS");
 		if (imsg_add(wbuf, &color, sizeof(color)) == -1)
 			return got_error_from_errno("imsg_add PAINTED_COMMITS");
@@ -3436,7 +3436,7 @@ got_privsep_recv_painted_commits(struct got_object_id_
 
 			if (icommits.present_in_pack) {
 				struct got_object_id id;
-				memcpy(id.sha1, icommit.id, SHA1_DIGEST_LENGTH);
+				memcpy(id.hash, icommit.id, SHA1_DIGEST_LENGTH);
 				err = cb(cb_arg, &id, icommit.color);
 				if (err)
 					break;
@@ -3445,7 +3445,7 @@ got_privsep_recv_painted_commits(struct got_object_id_
 				err = got_object_qid_alloc_partial(&qid);
 				if (err)
 					break;
-				memcpy(qid->id.sha1, icommit.id,
+				memcpy(qid->id.hash, icommit.id,
 				    SHA1_DIGEST_LENGTH);
 				qid->data = (void *)icommit.color;
 				STAILQ_INSERT_TAIL(new_ids, qid, entry);
blob - ed17dd58dd4864a824f87a1d54d2cd42169bef1e
blob + c6f5023144580d7c199ef6b8a5a01563683a2295
--- lib/reference.c
+++ lib/reference.c
@@ -161,7 +161,7 @@ parse_ref_line(struct got_reference **ref, const char 
 		return parse_symref(ref, name, line);
 	}
 
-	if (!got_parse_sha1_digest(id.sha1, line))
+	if (!got_parse_sha1_digest(id.hash, line))
 		return got_error(GOT_ERR_BAD_REF_DATA);
 
 	return alloc_ref(ref, name, &id, 0, mtime);
@@ -299,7 +299,7 @@ parse_packed_ref_line(struct got_reference **ref, cons
 	if (line[0] == '#' || line[0] == '^')
 		return NULL;
 
-	if (!got_parse_sha1_digest(id.sha1, line))
+	if (!got_parse_sha1_digest(id.hash, line))
 		return got_error(GOT_ERR_BAD_REF_DATA);
 
 	if (abs_refname) {
blob - e754fef75fcc2d66013a8f85b64547acc0aea1c4
blob + 035b7755844e1535807379a27b51c214e2352f0a
--- lib/repository.c
+++ lib/repository.c
@@ -1058,7 +1058,7 @@ got_repo_check_packidx_bloom_filter(struct got_reposit
 
 	bf = get_packidx_bloom_filter(repo, path_packidx, strlen(path_packidx));
 	if (bf)
-		return bloom_check(bf->bloom, id->sha1, sizeof(id->sha1));
+		return bloom_check(bf->bloom, id->hash, sizeof(id->hash));
 
 	/* No bloom filter means this pack index must be searched. */
 	return 1;
@@ -1110,7 +1110,7 @@ add_packidx_bloom_filter(struct got_repository *repo,
 	for (i = 0; i < nobjects; i++) {
 		struct got_packidx_object_id *id;
 		id = &packidx->hdr.sorted_ids[i];
-		bloom_add(bf->bloom, id->sha1, sizeof(id->sha1));
+		bloom_add(bf->bloom, id->hash, sizeof(id->hash));
 	}
 
 	RB_INSERT(got_packidx_bloom_filter_tree,
@@ -1709,7 +1709,7 @@ match_loose_object(struct got_object_id **unique_id, c
 			goto done;
 		}
 
-		if (!got_parse_sha1_digest(id.sha1, id_str))
+		if (!got_parse_sha1_digest(id.hash, id_str))
 			continue;
 
 		/*
@@ -2245,7 +2245,7 @@ got_repo_get_loose_object_info(int *nobjects, off_t *o
 				goto done;
 			}
 
-			if (!got_parse_sha1_digest(id.sha1, id_str)) {
+			if (!got_parse_sha1_digest(id.hash, id_str)) {
 				free(id_str);
 				continue;
 			}
blob - 0be05225c5acde90af06fcbe60d29ec6a8044bbe
blob + ae3dbc005fc34c20b89ea3db6c49aa8107757906
--- lib/repository_admin.c
+++ lib/repository_admin.c
@@ -153,7 +153,7 @@ got_repo_pack_objects(FILE **packfile, struct got_obje
 	struct got_object_id **ours = NULL, **theirs = NULL;
 	int nours = 0, ntheirs = 0, packfd = -1, i;
 	char *tmpfile_path = NULL, *path = NULL, *packfile_path = NULL;
-	char *sha1_str = NULL;
+	char *hash_str = NULL;
 	FILE *delta_cache = NULL;
 	struct got_ratelimit rl;
 
@@ -208,18 +208,18 @@ got_repo_pack_objects(FILE **packfile, struct got_obje
 		goto done;
 	}
 
-	err = got_pack_create((*pack_hash)->sha1, packfd, delta_cache,
+	err = got_pack_create((*pack_hash)->hash, packfd, delta_cache,
 	    theirs, ntheirs, ours, nours, repo, loose_obj_only, 0,
 	    progress_cb, progress_arg, &rl, cancel_cb, cancel_arg);
 	if (err)
 		goto done;
 
-	err = got_object_id_str(&sha1_str, *pack_hash);
+	err = got_object_id_str(&hash_str, *pack_hash);
 	if (err)
 		goto done;
 	if (asprintf(&packfile_path, "%s/%s/pack-%s.pack",
 	    got_repo_get_path_git_dir(repo), GOT_OBJECTS_PACK_DIR,
-	    sha1_str) == -1) {
+	    hash_str) == -1) {
 		err = got_error_from_errno("asprintf");
 		goto done;
 	}
@@ -257,7 +257,7 @@ done:
 		err = got_error_from_errno2("unlink", tmpfile_path);
 	free(tmpfile_path);
 	free(packfile_path);
-	free(sha1_str);
+	free(hash_str);
 	free(path);
 	if (err) {
 		free(*pack_hash);
@@ -363,7 +363,7 @@ got_repo_index_pack(FILE *packfile, struct got_object_
 		err = got_error_from_errno("dup");
 		goto done;
 	}
-	err = got_privsep_send_index_pack_req(&idxibuf, pack_hash->sha1,
+	err = got_privsep_send_index_pack_req(&idxibuf, pack_hash->hash,
 	    npackfd);
 	if (err != NULL)
 		goto done;
@@ -484,7 +484,7 @@ got_repo_find_pack(FILE **packfile, struct got_object_
 		goto done;
 	}
 	*dot = '\0';
-	if (!got_parse_sha1_digest(id.sha1, p)) {
+	if (!got_parse_sha1_digest(id.hash, p)) {
 		err = got_error_fmt(GOT_ERR_BAD_PATH,
 		    "'%s' is not a valid pack file name",
 		    packfile_name);
@@ -569,7 +569,7 @@ got_repo_list_pack(FILE *packfile, struct got_object_i
 				break;
 		}
 		oid = &packidx->hdr.sorted_ids[i];
-		memcpy(id.sha1, oid->sha1, SHA1_DIGEST_LENGTH);
+		memcpy(id.hash, oid->hash, SHA1_DIGEST_LENGTH);
 
 		offset = got_packidx_get_object_offset(packidx, i);
 		if (offset == -1) {
@@ -684,7 +684,7 @@ get_loose_object_ids(struct got_object_idset **loose_i
 			}
 
 			memset(&id, 0, sizeof(id));
-			if (!got_parse_sha1_digest(id.sha1, id_str)) {
+			if (!got_parse_sha1_digest(id.hash, id_str)) {
 				free(id_str);
 				continue;
 			}
blob - ec59732b5d47bf06ab52a0c1cced9366c7816e51
blob + 59601906a0dc01515656d60f8ca2828c435acf2c
--- lib/send.c
+++ lib/send.c
@@ -345,7 +345,7 @@ got_send_pack(const char *remote_name, struct got_path
 	int refs_to_send = 0, refs_to_delete = 0;
 	off_t bytes_sent = 0, bytes_sent_cur = 0;
 	struct pack_progress_arg ppa;
-	uint8_t packsha1[SHA1_DIGEST_LENGTH];
+	uint8_t packhash[SHA1_DIGEST_LENGTH];
 	int packfd = -1;
 	FILE *delta_cache = NULL;
 
@@ -646,7 +646,7 @@ got_send_pack(const char *remote_name, struct got_path
 		memset(&ppa, 0, sizeof(ppa));
 		ppa.progress_cb = progress_cb;
 		ppa.progress_arg = progress_arg;
-		err = got_pack_create(packsha1, packfd, delta_cache,
+		err = got_pack_create(packhash, packfd, delta_cache,
 		    their_ids, ntheirs, our_ids, nours, repo, 0, 1,
 		    pack_progress, &ppa, &rl, cancel_cb, cancel_arg);
 		if (err)
blob - 463be5bf1c6d96c601149d660c3857be5d14931d
blob + 7e768b7563d7862a3e44bda3804c8d781a8e307e
--- lib/worktree.c
+++ lib/worktree.c
@@ -1100,7 +1100,7 @@ create_fileindex_entry(struct got_fileindex_entry **ne
 		return err;
 
 	err = got_fileindex_entry_update(new_ie, wt_fd, path,
-	    blob_id->sha1, base_commit_id->sha1, 1);
+	    blob_id->hash, base_commit_id->hash, 1);
 	if (err)
 		goto done;
 
@@ -1717,9 +1717,9 @@ get_file_status(unsigned char *status, struct stat *sb
 
 	if (staged_status == GOT_STATUS_MODIFY ||
 	    staged_status == GOT_STATUS_ADD)
-		memcpy(id.sha1, ie->staged_blob_sha1, sizeof(id.sha1));
+		memcpy(id.hash, ie->staged_blob_hash, sizeof(id.hash));
 	else
-		memcpy(id.sha1, ie->blob_sha1, sizeof(id.sha1));
+		memcpy(id.hash, ie->blob_hash, sizeof(id.hash));
 
 	fd1 = got_opentempfd();
 	if (fd1 == -1) {
@@ -1810,7 +1810,7 @@ sync_timestamps(int wt_fd, const char *path, unsigned 
 {
 	if (status == GOT_STATUS_NO_CHANGE && stat_info_differs(ie, sb))
 		return got_fileindex_entry_update(ie, wt_fd, path,
-		    ie->blob_sha1, ie->commit_sha1, 1);
+		    ie->blob_hash, ie->commit_hash, 1);
 
 	return NULL;
 }
@@ -1884,7 +1884,7 @@ update_blob(struct got_worktree *worktree,
 		 * updating contents of this file.
 		 */
 		if (got_fileindex_entry_has_commit(ie) &&
-		    memcmp(ie->commit_sha1, worktree->base_commit_id->sha1,
+		    memcmp(ie->commit_hash, worktree->base_commit_id->hash,
 		    SHA1_DIGEST_LENGTH) == 0) {
 			/* Same commit. */
 			err = sync_timestamps(worktree->root_fd,
@@ -1896,7 +1896,7 @@ update_blob(struct got_worktree *worktree,
 			goto done;
 		}
 		if (got_fileindex_entry_has_blob(ie) &&
-		    memcmp(ie->blob_sha1, te->id.sha1,
+		    memcmp(ie->blob_hash, te->id.hash,
 		    SHA1_DIGEST_LENGTH) == 0) {
 			/* Different commit but the same blob. */
 			err = sync_timestamps(worktree->root_fd,
@@ -1929,7 +1929,7 @@ update_blob(struct got_worktree *worktree,
 				goto done;
 			}
 			struct got_object_id id2;
-			memcpy(id2.sha1, ie->blob_sha1, SHA1_DIGEST_LENGTH);
+			memcpy(id2.hash, ie->blob_hash, SHA1_DIGEST_LENGTH);
 			err = got_object_open_as_blob(&blob2, repo, &id2, 8192,
 			    fd2);
 			if (err)
@@ -1937,7 +1937,7 @@ update_blob(struct got_worktree *worktree,
 		}
 		if (got_fileindex_entry_has_commit(ie)) {
 			char id_str[SHA1_DIGEST_STRING_LENGTH];
-			if (got_sha1_digest_to_str(ie->commit_sha1, id_str,
+			if (got_sha1_digest_to_str(ie->commit_hash, id_str,
 			    sizeof(id_str)) == NULL) {
 				err = got_error_path(id_str,
 				    GOT_ERR_BAD_OBJ_ID_STR);
@@ -1979,17 +1979,17 @@ update_blob(struct got_worktree *worktree,
 		 * unmodified files again.
 		 */
 		err = got_fileindex_entry_update(ie, worktree->root_fd, path,
-		    blob->id.sha1, worktree->base_commit_id->sha1,
+		    blob->id.hash, worktree->base_commit_id->hash,
 		    update_timestamps);
 	} else if (status == GOT_STATUS_MODE_CHANGE) {
 		err = got_fileindex_entry_update(ie, worktree->root_fd, path,
-		    blob->id.sha1, worktree->base_commit_id->sha1, 0);
+		    blob->id.hash, worktree->base_commit_id->hash, 0);
 	} else if (status == GOT_STATUS_DELETE) {
 		err = (*progress_cb)(progress_arg, GOT_STATUS_MERGE, path);
 		if (err)
 			goto done;
 		err = got_fileindex_entry_update(ie, worktree->root_fd, path,
-		    blob->id.sha1, worktree->base_commit_id->sha1, 0);
+		    blob->id.hash, worktree->base_commit_id->hash, 0);
 		if (err)
 			goto done;
 	} else {
@@ -2012,8 +2012,8 @@ update_blob(struct got_worktree *worktree,
 
 		if (ie) {
 			err = got_fileindex_entry_update(ie,
-			    worktree->root_fd, path, blob->id.sha1,
-			    worktree->base_commit_id->sha1, 1);
+			    worktree->root_fd, path, blob->id.hash,
+			    worktree->base_commit_id->hash, 1);
 		} else {
 			err = create_fileindex_entry(&ie, fileindex,
 			    worktree->base_commit_id, worktree->root_fd, path,
@@ -2436,7 +2436,7 @@ bump_base_commit_id(void *arg, struct got_fileindex_en
 	if (got_fileindex_entry_was_skipped(ie))
 		return NULL;
 
-	if (memcmp(ie->commit_sha1, a->base_commit_id->sha1,
+	if (memcmp(ie->commit_hash, a->base_commit_id->hash,
 	    SHA1_DIGEST_LENGTH) == 0)
 		return NULL;
 
@@ -2446,7 +2446,7 @@ bump_base_commit_id(void *arg, struct got_fileindex_en
 		if (err)
 			return err;
 	}
-	memcpy(ie->commit_sha1, a->base_commit_id->sha1, SHA1_DIGEST_LENGTH);
+	memcpy(ie->commit_hash, a->base_commit_id->hash, SHA1_DIGEST_LENGTH);
 	return NULL;
 }
 
@@ -3032,8 +3032,8 @@ merge_file_cb(void *arg, struct got_blob_object *blob1
 				goto done;
 			if (status == GOT_STATUS_DELETE) {
 				err = got_fileindex_entry_update(ie,
-				    a->worktree->root_fd, path2, blob2->id.sha1,
-				    a->worktree->base_commit_id->sha1, 0);
+				    a->worktree->root_fd, path2, blob2->id.hash,
+				    a->worktree->base_commit_id->hash, 0);
 				if (err)
 					goto done;
 			}
@@ -3092,7 +3092,7 @@ check_mixed_commits(void *arg, struct got_fileindex_en
 
 	/* Reject merges into a work tree with mixed base commits. */
 	if (got_fileindex_entry_has_commit(ie) &&
-	    memcmp(ie->commit_sha1, worktree->base_commit_id->sha1,
+	    memcmp(ie->commit_hash, worktree->base_commit_id->hash,
 	    SHA1_DIGEST_LENGTH) != 0)
 		return got_error(GOT_ERR_MIXED_COMMITS);
 
@@ -3344,16 +3344,16 @@ report_file_status(struct got_fileindex_entry *ie, con
 		return NULL;
 
 	if (got_fileindex_entry_has_blob(ie)) {
-		memcpy(blob_id.sha1, ie->blob_sha1, SHA1_DIGEST_LENGTH);
+		memcpy(blob_id.hash, ie->blob_hash, SHA1_DIGEST_LENGTH);
 		blob_idp = &blob_id;
 	}
 	if (got_fileindex_entry_has_commit(ie)) {
-		memcpy(commit_id.sha1, ie->commit_sha1, SHA1_DIGEST_LENGTH);
+		memcpy(commit_id.hash, ie->commit_hash, SHA1_DIGEST_LENGTH);
 		commit_idp = &commit_id;
 	}
 	if (staged_status == GOT_STATUS_ADD ||
 	    staged_status == GOT_STATUS_MODIFY) {
-		memcpy(staged_blob_id.sha1, ie->staged_blob_sha1,
+		memcpy(staged_blob_id.hash, ie->staged_blob_hash,
 		    SHA1_DIGEST_LENGTH);
 		staged_blob_idp = &staged_blob_id;
 	}
@@ -3407,8 +3407,8 @@ status_old(void *arg, struct got_fileindex_entry *ie, 
 	if (!got_path_is_child(ie->path, a->status_path, a->status_path_len))
 		return NULL;
 
-	memcpy(blob_id.sha1, ie->blob_sha1, SHA1_DIGEST_LENGTH);
-	memcpy(commit_id.sha1, ie->commit_sha1, SHA1_DIGEST_LENGTH);
+	memcpy(blob_id.hash, ie->blob_hash, SHA1_DIGEST_LENGTH);
+	memcpy(commit_id.hash, ie->commit_hash, SHA1_DIGEST_LENGTH);
 	if (got_fileindex_entry_has_file_on_disk(ie))
 		status = GOT_STATUS_MISSING;
 	else
@@ -4783,10 +4783,10 @@ revert_file(void *arg, unsigned char status, unsigned 
 		struct got_object_id id;
 		if (staged_status == GOT_STATUS_ADD ||
 		    staged_status == GOT_STATUS_MODIFY) {
-			memcpy(id.sha1, ie->staged_blob_sha1,
+			memcpy(id.hash, ie->staged_blob_hash,
 			    SHA1_DIGEST_LENGTH);
 		} else
-			memcpy(id.sha1, ie->blob_sha1,
+			memcpy(id.hash, ie->blob_hash,
 			    SHA1_DIGEST_LENGTH);
 		fd = got_opentempfd();
 		if (fd == -1) {
@@ -4850,8 +4850,8 @@ revert_file(void *arg, unsigned char status, unsigned 
 			    status == GOT_STATUS_MODE_CHANGE) {
 				err = got_fileindex_entry_update(ie,
 				    a->worktree->root_fd, relpath,
-				    blob->id.sha1,
-				    a->worktree->base_commit_id->sha1, 1);
+				    blob->id.hash,
+				    a->worktree->base_commit_id->hash, 1);
 				if (err)
 					goto done;
 			}
@@ -5816,22 +5816,22 @@ update_fileindex_after_commit(struct got_worktree *wor
 
 				err = got_fileindex_entry_update(ie,
 				    worktree->root_fd, relpath,
-				    ct->staged_blob_id->sha1,
-				    new_base_commit_id->sha1,
+				    ct->staged_blob_id->hash,
+				    new_base_commit_id->hash,
 				    !have_staged_files);
 			} else
 				err = got_fileindex_entry_update(ie,
 				    worktree->root_fd, relpath,
-				    ct->blob_id->sha1,
-				    new_base_commit_id->sha1,
+				    ct->blob_id->hash,
+				    new_base_commit_id->hash,
 				    !have_staged_files);
 		} else {
 			err = got_fileindex_entry_alloc(&ie, pe->path);
 			if (err)
 				goto done;
 			err = got_fileindex_entry_update(ie,
-			    worktree->root_fd, relpath, ct->blob_id->sha1,
-			    new_base_commit_id->sha1, 1);
+			    worktree->root_fd, relpath, ct->blob_id->hash,
+			    new_base_commit_id->hash, 1);
 			if (err) {
 				got_fileindex_entry_free(ie);
 				goto done;
@@ -6279,7 +6279,7 @@ check_rebase_ok(void *arg, struct got_fileindex_entry 
 	char *ondisk_path;
 
 	/* Reject rebase of a work tree with mixed base commits. */
-	if (memcmp(ie->commit_sha1, a->worktree->base_commit_id->sha1,
+	if (memcmp(ie->commit_hash, a->worktree->base_commit_id->hash,
 	    SHA1_DIGEST_LENGTH))
 		return got_error(GOT_ERR_MIXED_COMMITS);
 
@@ -8282,7 +8282,7 @@ check_stage_ok(void *arg, unsigned char status,
 		return got_error_from_errno("asprintf");
 
 	if (got_fileindex_entry_has_commit(ie)) {
-		memcpy(base_commit_id.sha1, ie->commit_sha1,
+		memcpy(base_commit_id.hash, ie->commit_hash,
 		    SHA1_DIGEST_LENGTH);
 		base_commit_idp = &base_commit_id;
 	}
@@ -8377,7 +8377,7 @@ stage_path(void *arg, unsigned char status,
 		    path_content ? path_content : ondisk_path, a->repo);
 		if (err)
 			break;
-		memcpy(ie->staged_blob_sha1, new_staged_blob_id->sha1,
+		memcpy(ie->staged_blob_hash, new_staged_blob_id->hash,
 		    SHA1_DIGEST_LENGTH);
 		if (status == GOT_STATUS_ADD || staged_status == GOT_STATUS_ADD)
 			stage = GOT_FILEIDX_STAGE_ADD;
@@ -8429,8 +8429,8 @@ stage_path(void *arg, unsigned char status,
 		 * When staging the reverse of the staged diff,
 		 * implicitly unstage the file.
 		 */
-		if (memcmp(ie->staged_blob_sha1, ie->blob_sha1,
-		    sizeof(ie->blob_sha1)) == 0) {
+		if (memcmp(ie->staged_blob_hash, ie->blob_hash,
+		    sizeof(ie->blob_hash)) == 0) {
 			got_fileindex_entry_stage_set(ie,
 			    GOT_FILEIDX_STAGE_NONE);
 		}
@@ -8847,7 +8847,7 @@ unstage_hunks(struct got_object_id *staged_blob_id,
 		goto done;
 
 	if (new_staged_blob_id) {
-		memcpy(ie->staged_blob_sha1, new_staged_blob_id->sha1,
+		memcpy(ie->staged_blob_hash, new_staged_blob_id->hash,
 		    SHA1_DIGEST_LENGTH);
 	} else {
 		got_fileindex_entry_stage_set(ie, GOT_FILEIDX_STAGE_NONE);
@@ -9117,19 +9117,19 @@ report_file_info(void *arg, struct got_fileindex_entry
 		return NULL;
 
 	if (got_fileindex_entry_has_blob(ie)) {
-		memcpy(blob_id.sha1, ie->blob_sha1, SHA1_DIGEST_LENGTH);
+		memcpy(blob_id.hash, ie->blob_hash, SHA1_DIGEST_LENGTH);
 		blob_idp = &blob_id;
 	}
 	stage = got_fileindex_entry_stage_get(ie);
 	if (stage == GOT_FILEIDX_STAGE_MODIFY ||
 	    stage == GOT_FILEIDX_STAGE_ADD) {
-		memcpy(staged_blob_id.sha1, ie->staged_blob_sha1,
+		memcpy(staged_blob_id.hash, ie->staged_blob_hash,
 		    SHA1_DIGEST_LENGTH);
 		staged_blob_idp = &staged_blob_id;
 	}
 
 	if (got_fileindex_entry_has_commit(ie)) {
-		memcpy(commit_id.sha1, ie->commit_sha1, SHA1_DIGEST_LENGTH);
+		memcpy(commit_id.hash, ie->commit_hash, SHA1_DIGEST_LENGTH);
 		commit_idp = &commit_id;
 	}
 
blob - 77ba914fb971f5e412b57bd1633bda6ee0e1f26d
blob + f24f6e6f2f6873e05e6005d3b1a31dfae6218797
--- libexec/got-fetch-pack/got-fetch-pack.c
+++ libexec/got-fetch-pack/got-fetch-pack.c
@@ -166,10 +166,10 @@ send_fetch_download_progress(struct imsgbuf *ibuf, off
 }
 
 static const struct got_error *
-send_fetch_done(struct imsgbuf *ibuf, uint8_t *pack_sha1)
+send_fetch_done(struct imsgbuf *ibuf, uint8_t *pack_hash)
 {
 	if (imsg_compose(ibuf, GOT_IMSG_FETCH_DONE, 0, 0, -1,
-	    pack_sha1, SHA1_DIGEST_LENGTH) == -1)
+	    pack_hash, SHA1_DIGEST_LENGTH) == -1)
 		return got_error_from_errno("imsg_compose FETCH");
 	return got_privsep_flush_imsg(ibuf);
 }
@@ -292,7 +292,7 @@ send_fetch_ref(struct imsgbuf *ibuf, struct got_object
 }
 
 static const struct got_error *
-fetch_pack(int fd, int packfd, uint8_t *pack_sha1,
+fetch_pack(int fd, int packfd, uint8_t *pack_hash,
     struct got_pathlist_head *have_refs, int fetch_all_branches,
     struct got_pathlist_head *wanted_branches,
     struct got_pathlist_head *wanted_refs, int list_refs_only,
@@ -312,14 +312,14 @@ fetch_pack(int fd, int packfd, uint8_t *pack_sha1,
 	struct got_pathlist_entry *pe;
 	int sent_my_capabilites = 0, have_sidebands = 0;
 	int found_branch = 0;
-	SHA1_CTX sha1_ctx;
-	uint8_t sha1_buf[SHA1_DIGEST_LENGTH];
-	size_t sha1_buf_len = 0;
+	SHA1_CTX hash_ctx;
+	uint8_t hash_buf[SHA1_DIGEST_LENGTH];
+	size_t hash_buf_len = 0;
 	ssize_t w;
 	struct got_ratelimit rl;
 
 	TAILQ_INIT(&symrefs);
-	SHA1Init(&sha1_ctx);
+	SHA1Init(&hash_ctx);
 	got_ratelimit_init(&rl, 0, 500);
 
 	have = malloc(refsz * sizeof(have[0]));
@@ -449,7 +449,7 @@ fetch_pack(int fd, int packfd, uint8_t *pack_sha1,
 				goto done;
 			}
 		}
-		if (!got_parse_sha1_digest(want[nref].sha1, id_str)) {
+		if (!got_parse_sha1_digest(want[nref].hash, id_str)) {
 			err = got_error(GOT_ERR_BAD_OBJ_ID_STR);
 			goto done;
 		}
@@ -491,7 +491,7 @@ fetch_pack(int fd, int packfd, uint8_t *pack_sha1,
 	for (i = 0; i < nref; i++) {
 		if (got_object_id_cmp(&have[i], &want[i]) == 0)
 			continue;
-		got_sha1_digest_to_str(want[i].sha1, hashstr, sizeof(hashstr));
+		got_sha1_digest_to_str(want[i].hash, hashstr, sizeof(hashstr));
 		n = snprintf(buf, sizeof(buf), "want %s%s\n", hashstr,
 		    sent_my_capabilites || my_capabilities == NULL ?
 		    "" : my_capabilities);
@@ -514,7 +514,7 @@ fetch_pack(int fd, int packfd, uint8_t *pack_sha1,
 
 	TAILQ_FOREACH(pe, have_refs, entry) {
 		struct got_object_id *id = pe->data;
-		got_sha1_digest_to_str(id->sha1, hashstr, sizeof(hashstr));
+		got_sha1_digest_to_str(id->hash, hashstr, sizeof(hashstr));
 		n = snprintf(buf, sizeof(buf), "have %s\n", hashstr);
 		if (n < 0 || (size_t)n >= sizeof(buf)) {
 			err = got_error(GOT_ERR_NO_SPACE);
@@ -547,7 +547,7 @@ fetch_pack(int fd, int packfd, uint8_t *pack_sha1,
 			    "unexpected message from server");
 			goto done;
 		}
-		if (!got_parse_sha1_digest(common_id.sha1, buf + 4)) {
+		if (!got_parse_sha1_digest(common_id.hash, buf + 4)) {
 			err = got_error_msg(GOT_ERR_BAD_PACKET,
 			    "bad object ID in ACK packet from server");
 			goto done;
@@ -683,49 +683,49 @@ fetch_pack(int fd, int packfd, uint8_t *pack_sha1,
 		 * We can assume r > 0 since otherwise the loop would exit.
 		 */
 		if (r < SHA1_DIGEST_LENGTH) {
-			if (sha1_buf_len < SHA1_DIGEST_LENGTH) {
+			if (hash_buf_len < SHA1_DIGEST_LENGTH) {
 				/*
 				 * If there's enough buffered + read data to
 				 * fill up the buffer then shift a sufficient
 				 * amount of bytes out at the front to make
 				 * room, mixing those bytes into the checksum.
 				 */
-				if (sha1_buf_len > 0 &&
-				    sha1_buf_len + r > SHA1_DIGEST_LENGTH) {
-					size_t nshift = MIN(sha1_buf_len + r -
-					    SHA1_DIGEST_LENGTH, sha1_buf_len);
-					SHA1Update(&sha1_ctx, sha1_buf, nshift);
-					memmove(sha1_buf, sha1_buf + nshift,
-					    sha1_buf_len - nshift);
-					sha1_buf_len -= nshift;
+				if (hash_buf_len > 0 &&
+				    hash_buf_len + r > SHA1_DIGEST_LENGTH) {
+					size_t nshift = MIN(hash_buf_len + r -
+					    SHA1_DIGEST_LENGTH, hash_buf_len);
+					SHA1Update(&hash_ctx, hash_buf, nshift);
+					memmove(hash_buf, hash_buf + nshift,
+					    hash_buf_len - nshift);
+					hash_buf_len -= nshift;
 				}
 
 				/* Buffer potential checksum bytes. */
-				memcpy(sha1_buf + sha1_buf_len, buf, r);
-				sha1_buf_len += r;
+				memcpy(hash_buf + hash_buf_len, buf, r);
+				hash_buf_len += r;
 			} else {
 				/*
 				 * Mix in previously buffered bytes which
 				 * are not part of the checksum after all.
 				 */
-				SHA1Update(&sha1_ctx, sha1_buf, r);
+				SHA1Update(&hash_ctx, hash_buf, r);
 
 				/* Update potential checksum buffer. */
-				memmove(sha1_buf, sha1_buf + r,
-				    sha1_buf_len - r);
-				memcpy(sha1_buf + sha1_buf_len - r, buf, r);
+				memmove(hash_buf, hash_buf + r,
+				    hash_buf_len - r);
+				memcpy(hash_buf + hash_buf_len - r, buf, r);
 			}
 		} else {
 			/* Mix in any previously buffered bytes. */
-			SHA1Update(&sha1_ctx, sha1_buf, sha1_buf_len);
+			SHA1Update(&hash_ctx, hash_buf, hash_buf_len);
 
 			/* Mix in bytes read minus potential checksum bytes. */
-			SHA1Update(&sha1_ctx, buf, r - SHA1_DIGEST_LENGTH);
+			SHA1Update(&hash_ctx, buf, r - SHA1_DIGEST_LENGTH);
 
 			/* Buffer potential checksum bytes. */
-			memcpy(sha1_buf, buf + r - SHA1_DIGEST_LENGTH,
+			memcpy(hash_buf, buf + r - SHA1_DIGEST_LENGTH,
 			    SHA1_DIGEST_LENGTH);
-			sha1_buf_len = SHA1_DIGEST_LENGTH;
+			hash_buf_len = SHA1_DIGEST_LENGTH;
 		}
 
 		/* Write packfile data to temporary pack file. */
@@ -752,9 +752,9 @@ fetch_pack(int fd, int packfd, uint8_t *pack_sha1,
 	if (err)
 		goto done;
 
-	SHA1Final(pack_sha1, &sha1_ctx);
-	if (sha1_buf_len != SHA1_DIGEST_LENGTH ||
-	    memcmp(pack_sha1, sha1_buf, sha1_buf_len) != 0) {
+	SHA1Final(pack_hash, &hash_ctx);
+	if (hash_buf_len != SHA1_DIGEST_LENGTH ||
+	    memcmp(pack_hash, hash_buf, hash_buf_len) != 0) {
 		err = got_error_msg(GOT_ERR_BAD_PACKFILE,
 		    "pack file checksum mismatch");
 	}
@@ -774,7 +774,7 @@ main(int argc, char **argv)
 {
 	const struct got_error *err = NULL;
 	int fetchfd = -1, packfd = -1;
-	uint8_t pack_sha1[SHA1_DIGEST_LENGTH];
+	uint8_t pack_hash[SHA1_DIGEST_LENGTH];
 	struct imsgbuf ibuf;
 	struct imsg imsg;
 	struct got_pathlist_head have_refs;
@@ -976,7 +976,7 @@ main(int argc, char **argv)
 	}
 	packfd = imsg.fd;
 
-	err = fetch_pack(fetchfd, packfd, pack_sha1, &have_refs,
+	err = fetch_pack(fetchfd, packfd, pack_hash, &have_refs,
 	    fetch_req.fetch_all_branches, &wanted_branches,
 	    &wanted_refs, fetch_req.list_refs_only, &ibuf);
 done:
@@ -989,7 +989,7 @@ done:
 	if (err != NULL)
 		got_privsep_send_error(&ibuf, err);
 	else
-		err = send_fetch_done(&ibuf, pack_sha1);
+		err = send_fetch_done(&ibuf, pack_hash);
 	if (err != NULL) {
 		fprintf(stderr, "%s: %s\n", getprogname(), err->msg);
 		got_privsep_send_error(&ibuf, err);
blob - 839a953c4f820616b747cbd3fcca9350a558fc68
blob + 6657e503515c41fdf784526799f05c150f19f071
--- libexec/got-read-blob/got-read-blob.c
+++ libexec/got-read-blob/got-read-blob.c
@@ -169,7 +169,7 @@ main(int argc, char *argv[])
 			if (err)
 				goto done;
 		}
-		SHA1Final(id.sha1, &sha1_ctx);
+		SHA1Final(id.hash, &sha1_ctx);
 		if (got_object_id_cmp(&expected_id, &id) != 0) {
 			err = got_error_checksum(&expected_id);
 			goto done;
blob - d3624830234626794cb116fcaee59a11d7cac75b
blob + a4f05c666f9492a89e9916bbdc3a01276c05fca9
--- libexec/got-read-pack/got-read-pack.c
+++ libexec/got-read-pack/got-read-pack.c
@@ -518,7 +518,7 @@ tree_path_changed(int *changed, uint8_t **buf1, uint8_
 			struct got_object_id id1, id2;
 			int idx;
 
-			memcpy(id1.sha1, pte1->id, SHA1_DIGEST_LENGTH);
+			memcpy(id1.hash, pte1->id, SHA1_DIGEST_LENGTH);
 			idx = got_packidx_get_object_idx(packidx, &id1);
 			if (idx == -1) {
 				err = got_error_no_obj(&id1);
@@ -534,7 +534,7 @@ tree_path_changed(int *changed, uint8_t **buf1, uint8_
 			if (err)
 				break;
 
-			memcpy(id2.sha1, pte2->id, SHA1_DIGEST_LENGTH);
+			memcpy(id2.hash, pte2->id, SHA1_DIGEST_LENGTH);
 			idx = got_packidx_get_object_idx(packidx, &id2);
 			if (idx == -1) {
 				err = got_error_no_obj(&id2);
@@ -572,7 +572,7 @@ send_traversed_commits(struct got_object_id *commit_id
 
 	for (i = 0; i < ncommits; i++) {
 		struct got_object_id *id = &commit_ids[i];
-		if (imsg_add(wbuf, id->sha1, SHA1_DIGEST_LENGTH) == -1) {
+		if (imsg_add(wbuf, id->hash, SHA1_DIGEST_LENGTH) == -1) {
 			return got_error_from_errno(
 			    "imsg_add TRAVERSED_COMMITS");
 		}
@@ -676,7 +676,7 @@ commit_traversal_request(struct imsg *imsg, struct ims
 			}
 			commit_ids = new;
 		}
-		memcpy(commit_ids[ncommits - 1].sha1, id.sha1,
+		memcpy(commit_ids[ncommits - 1].hash, id.hash,
 		    SHA1_DIGEST_LENGTH);
 
 		pid = STAILQ_FIRST(&commit->parent_ids);
@@ -746,7 +746,7 @@ commit_traversal_request(struct imsg *imsg, struct ims
 		}
 
 		if (!changed) {
-			memcpy(id.sha1, pid->id.sha1, SHA1_DIGEST_LENGTH);
+			memcpy(id.hash, pid->id.hash, SHA1_DIGEST_LENGTH);
 			got_object_commit_close(commit);
 			commit = pcommit;
 			pcommit = NULL;
@@ -1193,7 +1193,7 @@ enumerate_tree(int *have_all_entries, struct imsgbuf *
 	err = got_object_qid_alloc_partial(&qid);
 	if (err)
 		return err;
-	memcpy(&qid->id.sha1, tree_id, SHA1_DIGEST_LENGTH);
+	memcpy(&qid->id.hash, tree_id, SHA1_DIGEST_LENGTH);
 	qid->data = strdup(path);
 	if (qid->data == NULL) {
 		err = got_error_from_errno("strdup");
@@ -1244,7 +1244,7 @@ enumerate_tree(int *have_all_entries, struct imsgbuf *
 			err = got_object_qid_alloc_partial(&eqid);
 			if (err)
 				goto done;
-			memcpy(eqid->id.sha1, pte->id, sizeof(eqid->id.sha1));
+			memcpy(eqid->id.hash, pte->id, sizeof(eqid->id.hash));
 
 			if (got_object_idset_contains(idset, &eqid->id)) {
 				got_object_qid_free(eqid);
@@ -1797,7 +1797,7 @@ commit_painting_request(struct imsg *imsg, struct imsg
 	if (datalen != sizeof(ireq))
 		return got_error(GOT_ERR_PRIVSEP_LEN);
 	memcpy(&ireq, imsg->data, sizeof(ireq));
-	memcpy(id.sha1, ireq.id, SHA1_DIGEST_LENGTH);
+	memcpy(id.hash, ireq.id, SHA1_DIGEST_LENGTH);
 
 	err = queue_commit_id(&ids, &id, ireq.color);
 	if (err)
blob - 0fd0e6b2e84bfc5519482bd5ae802897596069f2
blob + 67c2a843fa823538aed295a7ae5a72c39b084434
--- libexec/got-send-pack/got-send-pack.c
+++ libexec/got-send-pack/got-send-pack.c
@@ -413,7 +413,7 @@ send_pack(int fd, struct got_pathlist_head *refs,
 			err = got_error_from_errno("malloc");
 			goto done;
 		}
-		if (!got_parse_sha1_digest(id->sha1, id_str)) {
+		if (!got_parse_sha1_digest(id->hash, id_str)) {
 			err = got_error(GOT_ERR_BAD_OBJ_ID_STR);
 			goto done;
 		}
@@ -462,7 +462,7 @@ send_pack(int fd, struct got_pathlist_head *refs,
 			goto done;
 		}
 
-		got_sha1_digest_to_str(their_id->sha1, old_hashstr,
+		got_sha1_digest_to_str(their_id->hash, old_hashstr,
 		    sizeof(old_hashstr));
 		got_sha1_digest_to_str(zero_id, new_hashstr,
 		    sizeof(new_hashstr));
@@ -504,13 +504,13 @@ send_pack(int fd, struct got_pathlist_head *refs,
 				}
 				continue;
 			}
-			got_sha1_digest_to_str(their_id->sha1, old_hashstr,
+			got_sha1_digest_to_str(their_id->hash, old_hashstr,
 			    sizeof(old_hashstr));
 		} else {
 			got_sha1_digest_to_str(zero_id, old_hashstr,
 			    sizeof(old_hashstr));
 		}
-		got_sha1_digest_to_str(id->sha1, new_hashstr,
+		got_sha1_digest_to_str(id->hash, new_hashstr,
 		    sizeof(new_hashstr));
 		err = describe_refchange(&n, &sent_my_capabilites,
 		    my_capabilities, buf, sizeof(buf), refname,
blob - f473bd34c3797403a9a540f9222323c574a6d2d6
blob + df87d0bd93b9a695ca67ce7fa10d7e1976b50f23
--- regress/idset/idset_test.c
+++ regress/idset/idset_test.c
@@ -69,15 +69,15 @@ idset_add_remove_iter(void)
 		goto done;
 	}
 
-	if (!got_parse_sha1_digest(id1.sha1, id_str1)) {
+	if (!got_parse_sha1_digest(id1.hash, id_str1)) {
 		err = got_error(GOT_ERR_BAD_OBJ_ID_STR);
 		goto done;
 	}
-	if (!got_parse_sha1_digest(id2.sha1, id_str2)) {
+	if (!got_parse_sha1_digest(id2.hash, id_str2)) {
 		err = got_error(GOT_ERR_BAD_OBJ_ID_STR);
 		goto done;
 	}
-	if (!got_parse_sha1_digest(id3.sha1, id_str3)) {
+	if (!got_parse_sha1_digest(id3.hash, id_str3)) {
 		err = got_error(GOT_ERR_BAD_OBJ_ID_STR);
 		goto done;
 	}