Commit Diff


commit - 95b631b25683415ef380e22998436c28ad3e34c0
commit + a41a7d4af7426fd81c7dcb8b98dae1c7d9ea9acd
blob - a4d19987c878bbc0be5a08026bc1ba88bf3a3f11
blob + 400bb753d71571f27a4b7c68c143f3aee2209b84
--- gotd/repo_imsg.c
+++ gotd/repo_imsg.c
@@ -45,11 +45,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) {
@@ -72,11 +72,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 - cbafb6f84a7a227fce20c6b4bceaf2d79bdba2d2
blob + d669ac33576178f13600531c2ca6a4de6959377e
--- gotd/repo_read.c
+++ gotd/repo_read.c
@@ -113,7 +113,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) {
@@ -184,7 +184,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");
@@ -433,10 +433,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);
@@ -476,10 +476,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);
blob - 9534a8dc0cbb055298ed2df9da2f4cc08ae9ad9f
blob + 71b8bbd363846bb481de5fd0914e2ca2e239ef34
--- gotd/repo_write.c
+++ gotd/repo_write.c
@@ -156,7 +156,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;
 	}
@@ -205,7 +205,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");
@@ -364,8 +364,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) {
@@ -421,7 +421,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++;
 	}
@@ -1144,8 +1144,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 - 8f00f2699c2d87d84a815df4188c27ed9fcc45c0
blob + 1e9bf9d8ca59c38661286e87f5efd24e2e8f3a47
--- gotd/session.c
+++ gotd/session.c
@@ -432,8 +432,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 - 7941cebcee734db2de13f407678a3b740f02ca32
blob + eec49fff02579b61fd3d35f81f6eb23e587eaa85
--- include/got_object.h
+++ include/got_object.h
@@ -23,7 +23,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 - d8bb60c6ff7c54513bc631ba36c3348e3ebe1788
blob + 8d5f8fd14fff204077d2cd4a0331172539711a6f
--- lib/fetch.c
+++ lib/fetch.c
@@ -297,7 +297,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. */
@@ -446,7 +446,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 - 8d63257a31ec340aa4c23346b7148d5331d4c107
blob + 60f97ae775a8f935216bfb3dc42d6489c9577044
--- lib/fileindex.c
+++ lib/fileindex.c
@@ -1236,7 +1236,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;
 }
 
@@ -1245,7 +1245,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;
 }
 
@@ -1254,7 +1254,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 - 188c28e9e67bdc37146176e911d6226b223c40d2
blob + efa475c109e9d2c29e6513913f23b931c3c49b42
--- lib/got_lib_pack.h
+++ lib/got_lib_pack.h
@@ -68,7 +68,7 @@ struct got_packidx_trailer {
 } __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. */
blob - f8b902a4c27338568c455eb639ecba5cbb38b8c2
blob + 6ce635e299cfb8a3b1d2cc29df47893282d7e9e6
--- 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:
@@ -151,7 +151,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 - d703aefd6b522073c9b2c3c3eb7f2cff2a4e3590
blob + 245107563b79be5b6697f5bf26b4135c01f0ce14
--- lib/object_create.c
+++ lib/object_create.c
@@ -204,7 +204,7 @@ got_object_blob_file_create(struct got_object_id **id,
 		err = got_error_from_errno("calloc");
 		goto done;
 	}
-	SHA1Final((*id)->sha1, &sha1_ctx);
+	SHA1Final((*id)->hash, &sha1_ctx);
 
 	if (fflush(*blobfile) != 0) {
 		err = got_error_from_errno("fflush");
@@ -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;
 		}
-		SHA1Update(&sha1_ctx, te->id.sha1, len);
+		SHA1Update(&sha1_ctx, te->id.hash, len);
 		treesize += n;
 	}
 
@@ -398,7 +398,7 @@ got_object_tree_create(struct got_object_id **id,
 		err = got_error_from_errno("calloc");
 		goto done;
 	}
-	SHA1Final((*id)->sha1, &sha1_ctx);
+	SHA1Final((*id)->hash, &sha1_ctx);
 
 	if (fflush(treefile) != 0) {
 		err = got_error_from_errno("fflush");
@@ -587,7 +587,7 @@ got_object_commit_create(struct got_object_id **id,
 		err = got_error_from_errno("calloc");
 		goto done;
 	}
-	SHA1Final((*id)->sha1, &sha1_ctx);
+	SHA1Final((*id)->hash, &sha1_ctx);
 
 	if (fflush(commitfile) != 0) {
 		err = got_error_from_errno("fflush");
@@ -854,7 +854,7 @@ got_object_tag_create(struct got_object_id **id,
 		err = got_error_from_errno("calloc");
 		goto done;
 	}
-	SHA1Final((*id)->sha1, &sha1_ctx);
+	SHA1Final((*id)->hash, &sha1_ctx);
 
 	if (fflush(tagfile) != 0) {
 		err = got_error_from_errno("fflush");
blob - 103067d7de3a1d7703e09e80cf6385c016733b27
blob + 45b6543107fec7f696e629209988e4f1ee48d628
--- lib/object_idset.c
+++ lib/object_idset.c
@@ -95,7 +95,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 - 0d4231ebe983b9f0f36e32dc6ea4cfa217100d03
blob + dece96df83ffd3846c7dbb45a31b59171112c076
--- lib/object_open_io.c
+++ lib/object_open_io.c
@@ -541,7 +541,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 - a5bc20986b8717cb89c1b8dbaf04600d65a17802
blob + 85cda810ac9020610cbd80274138c726f819350c
--- lib/object_parse.c
+++ lib/object_parse.c
@@ -72,7 +72,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 *
@@ -107,7 +107,7 @@ got_object_id_str(char **outbuf, struct got_object_id 
 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);
 }
 
 void
@@ -343,7 +343,7 @@ got_object_read_raw(uint8_t **outbuf, off_t *size, siz
 	}
 
 	got_hash_final(&ctx, hash);
-	if (got_hash_cmp(&ctx, expected_id->sha1, hash) != 0) {
+	if (got_hash_cmp(&ctx, expected_id->hash, hash) != 0) {
 		err = got_error_checksum(expected_id);
 		goto done;
 	}
@@ -387,7 +387,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;
@@ -642,7 +642,7 @@ got_object_parse_commit(struct got_commit_object **com
 			goto done;
 		}
 		s += label_len;
-		if (!got_parse_hash_digest((*commit)->tree_id->sha1, s, algo)) {
+		if (!got_parse_hash_digest((*commit)->tree_id->hash, s, algo)) {
 			err = got_error(GOT_ERR_BAD_OBJ_DATA);
 			goto done;
 		}
@@ -764,7 +764,7 @@ got_object_read_commit(struct got_commit_object **comm
 	if (err)
 		return err;
 
-	got_hash_final(&ctx, id.sha1);
+	got_hash_final(&ctx, id.hash);
 	if (got_object_id_cmp(expected_id, &id) != 0) {
 		err = got_error_checksum(expected_id);
 		goto done;
@@ -933,7 +933,7 @@ got_object_read_tree(struct got_parsed_tree_entry **en
 	if (err)
 		return err;
 
-	got_hash_final(&ctx, id.sha1);
+	got_hash_final(&ctx, id.hash);
 	if (got_object_id_cmp(expected_id, &id) != 0) {
 		err = got_error_checksum(expected_id);
 		goto done;
@@ -999,7 +999,7 @@ got_object_parse_tag(struct got_tag_object **tag, uint
 			goto done;
 		}
 		s += label_len;
-		if (!got_parse_hash_digest((*tag)->id.sha1, s, algo)) {
+		if (!got_parse_hash_digest((*tag)->id.hash, s, algo)) {
 			err = got_error(GOT_ERR_BAD_OBJ_DATA);
 			goto done;
 		}
@@ -1176,7 +1176,7 @@ got_object_read_tag(struct got_tag_object **tag, int f
 	if (err)
 		return err;
 
-	got_hash_final(&ctx, id.sha1);
+	got_hash_final(&ctx, id.hash);
 	if (got_object_id_cmp(expected_id, &id) != 0) {
 		err = got_error_checksum(expected_id);
 		goto done;
blob - 49c486d59d228e9e64cdacaa00c1cdbcd30296d7
blob + 2aa8a2b9cffabc5d5bde4b290258cfe254992bac
--- lib/pack.c
+++ lib/pack.c
@@ -489,7 +489,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;
 
@@ -502,7 +502,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)
@@ -658,7 +658,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;
 }
 
@@ -689,12 +689,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[GOT_OBJECT_ID_HEX_MAXLEN];
 		struct got_object_qid *qid;
 		int cmp;
 
-		if (!got_hash_digest_to_str(oid->sha1, id_str, sizeof(id_str),
+		if (!got_hash_digest_to_str(oid->hash, id_str, sizeof(id_str),
 		    algo))
 		        return got_error(GOT_ERR_NO_SPACE);
 
@@ -708,7 +708,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 - 8ada11b2e7b11cd4b1a0a33f8e42fa324adfcd04
blob + 5fe3a143b937f5d9546cfeb56eacda0494beb68a
--- lib/pack_create.c
+++ lib/pack_create.c
@@ -1577,11 +1577,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;
blob - d7107177f8056953e03aac01278c49f2aee6f81f
blob + 5870c50d33ebc831012351325d3c1f891cc564e6
--- lib/pack_index.c
+++ lib/pack_index.c
@@ -261,12 +261,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);
@@ -278,7 +278,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);
@@ -291,7 +291,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");
@@ -301,9 +301,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);
@@ -313,7 +313,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);
@@ -454,7 +454,7 @@ resolve_deltified_object(struct got_pack *pack, struct
 			goto done;
 	} else
 		SHA1Update(&ctx, buf, len);
-	SHA1Final(obj->id.sha1, &ctx);
+	SHA1Final(obj->id.hash, &ctx);
 done:
 	free(buf);
 	free(header);
@@ -484,7 +484,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(sha1, oid->hash, SHA1_DIGEST_LENGTH);
 		if (cmp == 0)
 			return -1; /* object already indexed */
 		else if (cmp > 0)
@@ -506,7 +506,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);
 	}
@@ -537,7 +537,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)
@@ -550,7 +550,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);
 	}
@@ -595,7 +595,7 @@ update_packidx(struct got_packidx *packidx, uint32_t n
 	int idx;
 	uint32_t nindexed = be32toh(packidx->hdr.fanout_table[0xff]);
 
-	idx = find_object_idx(packidx, obj->id.sha1);
+	idx = find_object_idx(packidx, obj->id.hash);
 	if (idx == -1)
 		return; /* object already indexed */
 
blob - 92514335bde2a392e0211cb8f5903c931aac55d2
blob + e6f4a149822160b5f8f31472e5749bb81e9bfa10
--- lib/patch.c
+++ lib/patch.c
@@ -706,7 +706,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;
 	}
@@ -771,8 +771,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 - caf8324d7d3d913238117b541700ab59021826c4
blob + 50de5ee871e1bce4796e0df633d7d317326f4669
--- lib/privsep.c
+++ lib/privsep.c
@@ -1550,7 +1550,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)++;
@@ -1784,7 +1784,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;
@@ -1855,7 +1855,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) {
@@ -2647,7 +2647,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)
@@ -2698,7 +2698,7 @@ got_privsep_recv_traversed_commits(struct got_commit_o
 				err = got_object_qid_alloc_partial(&qid);
 				if (err)
 					break;
-				memcpy(qid->id.sha1, sha1, SHA1_DIGEST_LENGTH);
+				memcpy(qid->id.hash, sha1, SHA1_DIGEST_LENGTH);
 				STAILQ_INSERT_TAIL(commit_ids, qid, entry);
 
 				/* The last commit may contain a change. */
@@ -2754,7 +2754,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");
@@ -2870,7 +2870,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;
@@ -2890,7 +2890,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) {
@@ -3372,7 +3372,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;
 
@@ -3419,7 +3419,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");
@@ -3507,7 +3507,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;
@@ -3516,7 +3516,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 - 47ff224bf7a9abf8dc6dbf39d3b8c6eb7c173a02
blob + 153649083be68fbacb30ebb82575b58f1020bc81
--- lib/reference.c
+++ lib/reference.c
@@ -162,7 +162,7 @@ parse_ref_line(struct got_reference **ref, const char 
 		return parse_symref(ref, name, line);
 	}
 
-	if (!got_parse_hash_digest(id.sha1, line, algo))
+	if (!got_parse_hash_digest(id.hash, line, algo))
 		return got_error(GOT_ERR_BAD_REF_DATA);
 
 	return alloc_ref(ref, name, &id, 0, mtime);
@@ -301,7 +301,7 @@ parse_packed_ref_line(struct got_reference **ref, cons
 	if (line[0] == '#' || line[0] == '^')
 		return NULL;
 
-	if (!got_parse_hash_digest(id.sha1, line, algo))
+	if (!got_parse_hash_digest(id.hash, line, algo))
 		return got_error(GOT_ERR_BAD_REF_DATA);
 
 	if (abs_refname) {
blob - f6ac7c86bcf7794ce925c45451471441e0d4827c
blob + a1c5c2856e555e0180042bbcf838e6e61f6814ea
--- lib/repository.c
+++ lib/repository.c
@@ -1106,7 +1106,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;
@@ -1158,7 +1158,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,
@@ -1757,7 +1757,7 @@ match_loose_object(struct got_object_id **unique_id, c
 			goto done;
 		}
 
-		if (!got_parse_hash_digest(id.sha1, id_str, repo->algo))
+		if (!got_parse_hash_digest(id.hash, id_str, repo->algo))
 			continue;
 
 		/*
@@ -2307,7 +2307,7 @@ got_repo_get_loose_object_info(int *nobjects, off_t *o
 				goto done;
 			}
 
-			if (!got_parse_hash_digest(id.sha1, id_str,
+			if (!got_parse_hash_digest(id.hash, id_str,
 			    repo->algo)) {
 				free(id_str);
 				continue;
blob - 97e7b226b771d2d7ddd6567ff605c8dcda2097b7
blob + 522c3393ca3e3bce08a4efda7994f68d175a30b1
--- 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,
 	    progress_cb, progress_arg, &rl, cancel_cb, cancel_arg);
 	if (err)
@@ -364,7 +364,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;
@@ -485,7 +485,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);
@@ -570,7 +570,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) {
@@ -685,7 +685,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 - 1b01d8f8ee6aa52241e5cbb76dc271482859bc00
blob + 85fbf48e6dbd6c3e6a2ebe1311daa8a61a0aa5a1
--- lib/worktree.c
+++ lib/worktree.c
@@ -1101,7 +1101,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;
 
@@ -1885,7 +1885,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,
@@ -1897,7 +1897,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_sha1, te->id.hash,
 		    SHA1_DIGEST_LENGTH) == 0) {
 			/* Different commit but the same blob. */
 			err = sync_timestamps(worktree->root_fd,
@@ -1980,17 +1980,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 {
@@ -2013,8 +2013,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_sha1, 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_sha1, a->base_commit_id->hash, SHA1_DIGEST_LENGTH);
 	return NULL;
 }
 
@@ -3033,8 +3033,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;
 			}
@@ -3093,7 +3093,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_sha1, worktree->base_commit_id->hash,
 	    SHA1_DIGEST_LENGTH) != 0)
 		return got_error(GOT_ERR_MIXED_COMMITS);
 
@@ -4844,8 +4844,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;
 			}
@@ -5810,22 +5810,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;
@@ -6273,7 +6273,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);
 
@@ -8370,7 +8370,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;
@@ -8840,7 +8840,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 - d1e73e2ed1c63a9ba5f476ed5a29c4017a421c39
blob + 7e257b5af05bc5505443956f102845a47d44621e
--- libexec/got-fetch-pack/got-fetch-pack.c
+++ libexec/got-fetch-pack/got-fetch-pack.c
@@ -300,7 +300,7 @@ fetch_ref(struct imsgbuf *ibuf, struct got_pathlist_he
 	const struct got_error *err;
 	char *theirs = NULL, *mine = NULL;
 
-	if (!got_parse_sha1_digest(want->sha1, id_str)) {
+	if (!got_parse_sha1_digest(want->hash, id_str)) {
 		err = got_error(GOT_ERR_BAD_OBJ_ID_STR);
 		goto done;
 	}
@@ -521,7 +521,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);
@@ -544,7 +544,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);
@@ -577,7 +577,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;
blob - 3c3632addec15ad4cda044f1a67ebddc26480865
blob + 91c4b3a6886513f019c967bee323d90699e8d6fb
--- libexec/got-read-blob/got-read-blob.c
+++ libexec/got-read-blob/got-read-blob.c
@@ -171,7 +171,7 @@ main(int argc, char *argv[])
 			if (err)
 				goto done;
 		}
-		got_hash_final(&ctx, id.sha1);
+		got_hash_final(&ctx, id.hash);
 		if (got_object_id_cmp(&expected_id, &id) != 0) {
 			err = got_error_checksum(&expected_id);
 			goto done;
blob - f89155c989d76f4e73e0f8031fae79c29ed15f53
blob + ca7cac34bcd12c5df8c223e410917d4fb6bb151a
--- libexec/got-read-pack/got-read-pack.c
+++ libexec/got-read-pack/got-read-pack.c
@@ -519,7 +519,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);
@@ -535,7 +535,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);
@@ -573,7 +573,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");
 		}
@@ -677,7 +677,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);
@@ -747,7 +747,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;
@@ -1194,7 +1194,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");
@@ -1245,7 +1245,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);
@@ -1798,7 +1798,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 - d1ffc719f8ca4925cb7bf8c3d4e5c8180824fb64
blob + baca0291979ba2ef5ff6c55f19704c125b04cfb0
--- libexec/got-send-pack/got-send-pack.c
+++ libexec/got-send-pack/got-send-pack.c
@@ -414,7 +414,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;
 		}
@@ -463,7 +463,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));
@@ -505,13 +505,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 - 511fd016b578a9308aede2f46618c2b7b6a353c2
blob + 42ee0e11ca38c06f090798d42182c197fcb40c02
--- regress/idset/idset_test.c
+++ regress/idset/idset_test.c
@@ -70,15 +70,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;
 	}