From: Junio C Hamano <gitster@pobox.com>
To: Son Luong Ngoc <sluongng@gmail.com>
Cc: Adam Majer <adamm@zombino.com>, Patrick Steinhardt <ps@pks.im>,
"brian m. carlson" <sandals@crustytoothpaste.net>,
git@vger.kernel.org
Subject: Re: SHA256 support not experimental, or?
Date: Fri, 30 Jun 2023 09:45:01 -0700 [thread overview]
Message-ID: <xmqqilb47vci.fsf@gitster.g> (raw)
In-Reply-To: <CAL3xRKfQLj7Zufy5fMMs=ykeexBn7duqFH1jZ84+WRKKOaEpFA@mail.gmail.com> (Son Luong Ngoc's message of "Fri, 30 Jun 2023 14:20:14 +0200")
Son Luong Ngoc <sluongng@gmail.com> writes:
> Build tools such as Bazel would often need to hash the content of the
> source files to build a dependency graph. And in a FUSE setup, it would
> be ideal if the FUSE server could supply the hash via an xattr, so that
> FUSE client does not need to fetch the whole file content and only the
> metadata.
This is unrelated tangent, but the implementation of virtual
filesystem on top of Git's object store will be able to give such
SHA-256 hash only by computing the hash itself, if the "hash the
content of the source files" has to be exactly SHA-256. Using Git
repository that uses SHA-256 would *not* help.
$ git init --object-format sha256
$ echo hello | git hash-object --stdin
2cf8d83d9ee29543b34a87727421fdecb7e3f3a183d337639025de576db9ebb4
$ echo hello | sha256sum
5891b5b522d5df086d0ff0b110fbd9d21bb4fc7163af34d08286a2e846f6be03 -
This is because the object name used by Git is not the hash of the
content. It is a hash of an object header (object type and byte
count) followed by its contents.
$ printf "blob 6\0hello\n" | sha256sum
2cf8d83d9ee29543b34a87727421fdecb7e3f3a183d337639025de576db9ebb4 -
The build systems can choose to tell FUSE server to expose the Git
object names via xattr, but if it needs to see if some contents (not
in FUSE) it has on hand is the same as what is stored in the FUSE
server, it needs to use the "slightly modified SHA-256" that matches
what Git uses. It would still be using some hash that has the same
strength as underlying SHA-256, but it is *not* SHA-256.
next prev parent reply other threads:[~2023-06-30 16:45 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-28 16:28 SHA256 support not experimental, or? Adam Majer
2023-06-29 1:59 ` brian m. carlson
2023-06-29 10:42 ` Adam Majer
2023-06-29 5:59 ` Junio C Hamano
2023-06-29 10:53 ` Adam Majer
2023-06-29 20:56 ` Junio C Hamano
2023-06-29 21:17 ` brian m. carlson
2023-06-29 22:22 ` Junio C Hamano
2023-06-30 1:21 ` brian m. carlson
2023-06-30 9:31 ` Patrick Steinhardt
2023-06-30 11:25 ` Adam Majer
2023-06-30 11:38 ` Patrick Steinhardt
2023-06-30 12:20 ` Son Luong Ngoc
2023-06-30 16:45 ` Junio C Hamano [this message]
2023-07-20 15:07 ` Adam Majer
2023-07-20 18:18 ` Junio C Hamano
2023-07-26 16:44 ` Junio C Hamano
2023-07-31 13:38 ` Adam Majer
2023-07-31 13:42 ` [PATCH] doc: sha256 is no longer experimental Adam Majer
2023-07-31 16:01 ` Junio C Hamano
2023-07-31 16:44 ` Adam Majer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqilb47vci.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=adamm@zombino.com \
--cc=git@vger.kernel.org \
--cc=ps@pks.im \
--cc=sandals@crustytoothpaste.net \
--cc=sluongng@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).