Commit Diff


commit - a62a9cd59d45e9b2d65e691529c380a6fddff4c7
commit + 7a968c0ed25628a1375e92fd6e10da7485f6ea06
blob - e7ffbe35c285fb2e83fb85251116d412bee6743d
blob + 77b067240f937a51ae13c32d0bbc9362d7796286
--- gotd/repo_imsg.c
+++ gotd/repo_imsg.c
@@ -50,7 +50,7 @@ gotd_imsg_send_ack(struct got_object_id *id, struct im
 		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) {
@@ -77,7 +77,7 @@ gotd_imsg_send_nak(struct got_object_id *id, struct im
 		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 - 8e583c72710583238e82354eae3e6075176b7820
blob + 1cfaea31afa52c9ffd7e5e5c14d8605279ead7cd
--- gotd/repo_read.c
+++ gotd/repo_read.c
@@ -115,7 +115,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) {
@@ -185,7 +185,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;
 	}
@@ -233,7 +233,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");
@@ -415,7 +415,7 @@ 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_object_id_hex(&id, hex, sizeof(hex)))
@@ -460,7 +460,7 @@ 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_object_id_hex(&id, hex, sizeof(hex)))
blob - 6562cd897111bbf157c2279bd29af3e12fe3aa1a
blob + ccba40109ee7f3669dde9c2c13b51d72d39158b2
--- gotd/repo_write.c
+++ gotd/repo_write.c
@@ -173,7 +173,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;
 	}
@@ -221,7 +221,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");
@@ -643,14 +643,14 @@ 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) {
 		if (err->code != GOT_ERR_NOT_REF)
 			goto done;
-		if (memcmp(ref_update->new_id.sha1,
+		if (memcmp(ref_update->new_id.hash,
 		    zero_id, sizeof(zero_id)) == 0) {
 			err = got_error_fmt(GOT_ERR_BAD_OBJ_ID,
 			    "%s", refname);
@@ -706,7 +706,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++;
 	}
@@ -1541,8 +1541,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.name_len = strlen(refname);
blob - d367657cf7189b3acce06cec296174ac9016c349
blob + 3e379f9e08e2cc6c3649d68f36f5aff4245910dc
--- gotd/session_write.c
+++ gotd/session_write.c
@@ -697,9 +697,9 @@ update_ref(int *shut, struct gotd_session_client *clie
 	log_debug("updating ref %s for uid %d", refname, client->euid);
 
 	memset(&old_id, 0, sizeof(old_id));
-	memcpy(old_id.sha1, iref.old_id, SHA1_DIGEST_LENGTH);
+	memcpy(old_id.hash, iref.old_id, SHA1_DIGEST_LENGTH);
 	memset(&new_id, 0, sizeof(new_id));
-	memcpy(new_id.sha1, iref.new_id, SHA1_DIGEST_LENGTH);
+	memcpy(new_id.hash, iref.new_id, SHA1_DIGEST_LENGTH);
 	err = got_repo_find_object_id(iref.delete_ref ? &old_id : &new_id,
 	    repo);
 	if (err)
blob - 32187d2046b3c350e8f51ea150d5f082f79ad56b
blob + 2274686ae2246b9d7b4294fbd041ff854de59b8e
--- include/got_object.h
+++ include/got_object.h
@@ -22,7 +22,7 @@ enum got_hash_algorithm {
 };
 
 struct got_object_id {
-	u_int8_t sha1[SHA1_DIGEST_LENGTH];
+	u_int8_t hash[SHA1_DIGEST_LENGTH];
 };
 
 struct got_blob_object;
blob - c0161ad25f562b9a152de2dc3d46259e2360c32b
blob + 00d3d6ab13e69cc6ad1cabc03980761c02cf2933
--- lib/fetch.c
+++ lib/fetch.c
@@ -302,7 +302,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. */
@@ -455,7 +455,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 - 5bcbcfa6ca6a299f58ac1d654a279b51a3b29ad4
blob + bd0bf8276ab597dc7ed38191a85fa2c472393a80
--- lib/fileindex.c
+++ lib/fileindex.c
@@ -1244,7 +1244,7 @@ got_fileindex_entry_get_staged_blob_id(struct got_obje
     struct got_fileindex_entry *ie)
 {
 	memset(id, 0, sizeof(*id));
-	memcpy(id->sha1, ie->staged_blob_sha1, sizeof(ie->staged_blob_sha1));
+	memcpy(id->hash, ie->staged_blob_sha1, sizeof(ie->staged_blob_sha1));
 	return id;
 }
 
@@ -1253,7 +1253,7 @@ got_fileindex_entry_get_blob_id(struct got_object_id *
     struct got_fileindex_entry *ie)
 {
 	memset(id, 0, sizeof(*id));
-	memcpy(id->sha1, ie->blob_sha1, sizeof(ie->blob_sha1));
+	memcpy(id->hash, ie->blob_sha1, sizeof(ie->blob_sha1));
 	return id;
 }
 
@@ -1262,7 +1262,7 @@ got_fileindex_entry_get_commit_id(struct got_object_id
     struct got_fileindex_entry *ie)
 {
 	memset(id, 0, sizeof(*id));
-	memcpy(id->sha1, ie->commit_sha1, sizeof(ie->commit_sha1));
+	memcpy(id->hash, ie->commit_sha1, sizeof(ie->commit_sha1));
 	return id;
 }
 
blob - c604f275f01dbbef64fe927f5c9abd75a32dd94d
blob + 858b723ec18cc35148de23dbc170ed12cff46f72
--- lib/hash.c
+++ lib/hash.c
@@ -46,7 +46,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 *
@@ -170,7 +170,7 @@ got_parse_hash_digest(uint8_t *digest, const char *lin
 char *
 got_object_id_hex(struct got_object_id *id, char *buf, size_t len)
 {
-	return got_sha1_digest_to_str(id->sha1, buf, len);
+	return got_sha1_digest_to_str(id->hash, buf, len);
 }
 
 int
@@ -183,7 +183,7 @@ got_parse_object_id(struct got_object_id *id, const ch
 	if (algo != GOT_HASH_SHA1)
 		return 0;
 
-	return got_parse_hash_digest(id->sha1, line, algo);
+	return got_parse_hash_digest(id->hash, line, algo);
 }
 
 void
@@ -221,7 +221,7 @@ got_hash_final_object_id(struct got_hash *hash, struct
 {
 	memset(id, 0, sizeof(*id));
 	if (hash->algo == GOT_HASH_SHA1)
-		SHA1Final(id->sha1, &hash->sha1_ctx);
+		SHA1Final(id->hash, &hash->sha1_ctx);
 	else
 		abort();
 }
blob - 544f59bad76e1479b2badc43c1532f06d70db9d9
blob + 962e7a4169b31da0b55afd2771071eb95ab32c11
--- lib/load.c
+++ lib/load.c
@@ -186,7 +186,7 @@ copypack(FILE *in, int outfd, off_t *tot,
 
 	/* XXX SHA256 */
 	memset(&expected_id, 0, sizeof(expected_id));
-	memcpy(&expected_id.sha1, sha1buf, sizeof(expected_id.sha1));
+	memcpy(&expected_id.hash, sha1buf, sizeof(expected_id.hash));
 
 	if (got_object_id_cmp(id, &expected_id) != 0)
 		return got_error(GOT_ERR_PACKIDX_CSUM);
@@ -425,7 +425,7 @@ got_repo_load(FILE *in, struct got_pathlist_head *refs
 	imsg_idxfds[1] = -1;
 	imsg_init(&idxibuf, imsg_idxfds[0]);
 
-	err = got_privsep_send_index_pack_req(&idxibuf, id.sha1, packfd);
+	err = got_privsep_send_index_pack_req(&idxibuf, id.hash, packfd);
 	if (err)
 		goto done;
 	packfd = -1;
blob - 2e12a69bb09622ca93b1e6240e2f9d4b5f204a91
blob + fa94d175e717cff80203dddea664810eba1e9ee5
--- lib/object.c
+++ lib/object.c
@@ -116,7 +116,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:
blob - 4ab8eb812ff2dae65b617a1f7699919ca73d32e9
blob + 31061919e0541beda09a3d663aa5909ef9240853
--- lib/object_create.c
+++ lib/object_create.c
@@ -384,12 +384,12 @@ got_object_tree_create(struct got_object_id **id,
 		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;
 		}
-		got_hash_update(&ctx, te->id.sha1, len);
+		got_hash_update(&ctx, te->id.hash, len);
 		treesize += n;
 	}
 
blob - c1602919d2977cd55ba83d051a26fb748e1153e5
blob + 743f12860b06971ab752a49e3b79f7e3e05fcd65
--- lib/object_idset.c
+++ lib/object_idset.c
@@ -96,7 +96,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 - 60307d5b70c26ee153a22138d08852f616acf52a
blob + c26d62c16a4a7b6b393af5f80b4f7e30a369c8c6
--- lib/object_open_io.c
+++ lib/object_open_io.c
@@ -565,7 +565,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 - 575de2dc2141ef035701b8d43cb5c8ae305c9fec
blob + 3e7306c44c58ef596f2c30790e4687ac2d89468e
--- lib/pack.c
+++ lib/pack.c
@@ -493,7 +493,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;
 	size_t digest_len = got_hash_digest_length(packidx->algo);
@@ -507,7 +507,7 @@ got_packidx_get_object_idx(struct got_packidx *packidx
 
 		i = ((left + right) / 2);
 		oid = packidx->hdr.sorted_ids + i * digest_len;
-		cmp = memcmp(id->sha1, oid, digest_len);
+		cmp = memcmp(id->hash, oid, digest_len);
 		if (cmp == 0)
 			return i;
 		else if (cmp > 0)
@@ -664,7 +664,7 @@ got_packidx_get_object_id(struct got_object_id *id,
 		return got_error(GOT_ERR_NO_OBJ);
 
 	oid = packidx->hdr.sorted_ids + idx * digest_len;
-	memcpy(id->sha1, oid, digest_len);
+	memcpy(id->hash, oid, digest_len);
 	return NULL;
 }
 
@@ -712,7 +712,7 @@ got_packidx_match_id_str_prefix(struct got_object_id_q
 		err = got_object_qid_alloc_partial(&qid);
 		if (err)
 			return err;
-		memcpy(qid->id.sha1, oid, digest_len);
+		memcpy(qid->id.hash, oid, digest_len);
 		STAILQ_INSERT_TAIL(matched_ids, qid, entry);
 
 		oid = packidx->hdr.sorted_ids + (++i) * digest_len;
blob - ac4cf855434fedcf1669f57482225399f9486b03
blob + fa93dc91c296087d5f21fbfafe66effd3f66b29e
--- lib/pack_create.c
+++ lib/pack_create.c
@@ -1578,11 +1578,11 @@ deltahdr(off_t *packfile_size, struct got_hash *ctx, i
 		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;
blob - bdf8d2fa044c36ef8e599957fb912fc761b444fb
blob + 420df55900fae5048926e340c76737b0480284d2
--- lib/pack_index.c
+++ lib/pack_index.c
@@ -242,13 +242,13 @@ read_packed_object(struct got_pack *pack, struct got_i
 		free(data);
 		break;
 	case GOT_OBJ_TYPE_REF_DELTA:
-		memset(obj->id.sha1, 0xff, digest_len);
+		memset(obj->id.hash, 0xff, digest_len);
 		if (pack->map) {
 			if (mapoff + digest_len >= pack->filesize) {
 				err = got_error(GOT_ERR_BAD_PACKFILE);
 				break;
 			}
-			memcpy(obj->delta.ref.ref_id.sha1, pack->map + mapoff,
+			memcpy(obj->delta.ref.ref_id.hash, pack->map + mapoff,
 			    digest_len);
 			obj->crc = crc32(obj->crc, pack->map + mapoff,
 			    digest_len);
@@ -261,7 +261,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,
 			    digest_len);
 			if (n == -1) {
 				err = got_error_from_errno("read");
@@ -271,10 +271,10 @@ 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,
 			    digest_len);
 			got_hash_update(pack_hash_ctx,
-			    obj->delta.ref.ref_id.sha1, digest_len);
+			    obj->delta.ref.ref_id.hash, digest_len);
 			err = got_inflate_to_mem_fd(NULL, &datalen, &obj->len,
 			    &csum, obj->size, pack->fd);
 			if (err)
@@ -283,7 +283,7 @@ read_packed_object(struct got_pack *pack, struct got_i
 		obj->len += digest_len;
 		break;
 	case GOT_OBJ_TYPE_OFFSET_DELTA:
-		memset(obj->id.sha1, 0xff, digest_len);
+		memset(obj->id.hash, 0xff, digest_len);
 		err = got_pack_parse_offset_delta(&obj->delta.ofs.base_offset,
 		    &obj->delta.ofs.base_offsetlen, pack, obj->off,
 		    obj->tslen);
@@ -513,7 +513,7 @@ add_indexed_object(struct got_packidx *packidx, uint32
 	size_t digest_len = got_hash_digest_length(packidx->algo);
 
 	oid = packidx->hdr.sorted_ids + idx * digest_len;
-	memcpy(oid, obj->id.sha1, digest_len);
+	memcpy(oid, obj->id.hash, digest_len);
 	packidx->hdr.crc32[idx] = htobe32(obj->crc);
 	if (obj->off < GOT_PACKIDX_OFFSET_VAL_IS_LARGE_IDX)
 		packidx->hdr.offsets[idx] = htobe32(obj->off);
@@ -525,7 +525,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);
 	}
@@ -572,7 +572,7 @@ update_packidx(struct got_packidx *packidx, uint32_t n
 	size_t digest_len = got_hash_digest_length(packidx->algo);
 	uint8_t *from, *to;
 
-	idx = find_object_idx(packidx, obj->id.sha1);
+	idx = find_object_idx(packidx, obj->id.hash);
 	if (idx == -1)
 		return; /* object already indexed */
 
blob - 2ba330c0f358f16e376a462ff551e80515cc1def
blob + ca34316533171eaaffebc13cf14010ae8e32d87c
--- lib/privsep.c
+++ lib/privsep.c
@@ -1585,7 +1585,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, sizeof(te->id.sha1));
+		memcpy(te->id.hash, ite.id, sizeof(te->id.sha1));
 		te->mode = ite.mode;
 		te->idx = *nentries;
 		(*nentries)++;
blob - feddab7822ac272eff0ebf1280dd08ce8e64454f
blob + dca64c5b3e52082226f276cca9afe7e6a997004e
--- lib/repository.c
+++ lib/repository.c
@@ -1236,7 +1236,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;
blob - 10594688c987e7923021d20f92967f9f61235ada
blob + f70fd48fd09091b36d366da7f2e938a4cf92b691
--- lib/repository_admin.c
+++ lib/repository_admin.c
@@ -209,7 +209,7 @@ 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, force_refdelta, progress_cb, progress_arg, &rl,
 	    cancel_cb, cancel_arg);
@@ -365,7 +365,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;
@@ -573,7 +573,7 @@ got_repo_list_pack(FILE *packfile, struct got_object_i
 				break;
 		}
 		oid = packidx->hdr.sorted_ids + i * digest_len;
-		memcpy(id.sha1, oid, digest_len);
+		memcpy(id.hash, oid, digest_len);
 
 		offset = got_packidx_get_object_offset(packidx, i);
 		if (offset == -1) {
@@ -1287,7 +1287,7 @@ pack_is_redundant(int *redundant, struct got_repositor
 		pid = packidx->hdr.sorted_ids + i * digest_len;
 
 		memset(&id, 0, sizeof(id));
-		memcpy(&id.sha1, pid, digest_len);
+		memcpy(&id.hash, pid, digest_len);
 
 		if (got_object_idset_contains(idset, &id))
 			continue;
blob - 6df059e9a98fbe2f538884f14d8c80a5e3f4fc97
blob + bcfaef17f181af2634bca5eb3d7db41766783487
--- lib/worktree.c
+++ lib/worktree.c
@@ -1117,7 +1117,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, update_timestamps);
+	    blob_id->hash, base_commit_id->hash, update_timestamps);
 	if (err)
 		goto done;
 
@@ -2003,7 +2003,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_sha1, worktree->base_commit_id->hash,
 		    SHA1_DIGEST_LENGTH) == 0) {
 			/* Same commit. */
 			err = sync_timestamps(worktree->root_fd,
@@ -2015,13 +2015,13 @@ 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_sha1, te->id.hash,
 		    SHA1_DIGEST_LENGTH) == 0) {
 			/* Different commit but the same blob. */
 			if (got_fileindex_entry_has_commit(ie)) {
 				/* Update the base commit ID of this file. */
 				memcpy(ie->commit_sha1,
-				    worktree->base_commit_id->sha1,
+				    worktree->base_commit_id->hash,
 				    sizeof(ie->commit_sha1));
 			}
 			err = sync_timestamps(worktree->root_fd,
@@ -2103,17 +2103,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 {
@@ -2137,8 +2137,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,
@@ -2571,7 +2571,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_sha1, a->base_commit_id->hash,
 	    SHA1_DIGEST_LENGTH) == 0)
 		return NULL;
 
@@ -2581,7 +2581,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_sha1, a->base_commit_id->hash, SHA1_DIGEST_LENGTH);
 	return NULL;
 }
 
@@ -2969,7 +2969,7 @@ add_file(struct got_worktree *worktree, struct got_fil
 		/* Re-adding a locally deleted file. */
 		err = got_fileindex_entry_update(ie,
 		    worktree->root_fd, path2, ie->blob_sha1,
-		    worktree->base_commit_id->sha1, 0);
+		    worktree->base_commit_id->hash, 0);
 		if (err)
 			return err;
 	}
@@ -3322,7 +3322,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, a->worktree->base_commit_id->sha1,
+	    memcmp(ie->commit_sha1, a->worktree->base_commit_id->hash,
 	    SHA1_DIGEST_LENGTH) != 0)
 		return got_error(GOT_ERR_MIXED_COMMITS);
 
@@ -5311,8 +5311,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;
 			}
@@ -6284,22 +6284,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;
@@ -6750,7 +6750,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_sha1, a->worktree->base_commit_id->hash,
 	    SHA1_DIGEST_LENGTH))
 		return got_error(GOT_ERR_MIXED_COMMITS);
 
@@ -9237,7 +9237,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_sha1, new_staged_blob_id->hash,
 		    SHA1_DIGEST_LENGTH);
 		if (status == GOT_STATUS_ADD || staged_status == GOT_STATUS_ADD)
 			stage = GOT_FILEIDX_STAGE_ADD;
@@ -9708,7 +9708,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_sha1, new_staged_blob_id->hash,
 		    SHA1_DIGEST_LENGTH);
 	} else {
 		got_fileindex_entry_stage_set(ie, GOT_FILEIDX_STAGE_NONE);
blob - f488cd9dcd98b68c647973cb84a54e18daefced4
blob + 84299babeb28ef6e301c8be76710ba7474a4deec
--- lib/worktree_cvg.c
+++ lib/worktree_cvg.c
@@ -2145,22 +2145,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;
blob - c7eef485c3721f42444509df2a03dc201784624a
blob + f08ec067641ea4c9b844f9d5ff590d976d692e18
--- libexec/got-read-pack/got-read-pack.c
+++ libexec/got-read-pack/got-read-pack.c
@@ -559,7 +559,7 @@ tree_path_changed(int *changed, uint8_t **buf1, size_t
 			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);
@@ -575,7 +575,7 @@ tree_path_changed(int *changed, uint8_t **buf1, size_t
 			next_entry1 = *buf1;
 			remain1 = *len1;
 
-			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);
@@ -1276,7 +1276,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);