# How To See Index File Checksum?

2 messages from 2025-08-17 to 2025-08-17. Participants: Jon Forrest, Jeff King.
Thread: https://gitlist.dev/t/63968

## Jon Forrest, 2025-08-17 01:32

Subject: How To See Index File Checksum?
Message-ID: <76ee89b3-39cf-4218-bbb6-1cc3c6e16ddf@gmail.com>
URL: https://gitlist.dev/e/76ee89b3-39cf-4218-bbb6-1cc3c6e16ddf%40gmail.com

```
I know how to see the checksums of the files in an index
file. But, I can't find a git command that shows the
checksum at the end of an index file.

Any ideas?

Cordially,
Jon Forrest


```

## Jeff King, 2025-08-17 01:50

Subject: Re: How To See Index File Checksum?
Message-ID: <20250817015013.GA6012@coredump.intra.peff.net>
URL: https://gitlist.dev/e/20250817015013.GA6012%40coredump.intra.peff.net
In-Reply-To: <76ee89b3-39cf-4218-bbb6-1cc3c6e16ddf@gmail.com>

```
On Sat, Aug 16, 2025 at 06:32:30PM -0700, Jon Forrest wrote:

> I know how to see the checksums of the files in an index
> file. But, I can't find a git command that shows the
> checksum at the end of an index file.

I don't think that there's a command to do so (likewise for other
checksum'd files like pack idx, etc). We'd usually check those during
fsck but I don't know of any specific command to print them. I'd usually
do something like:

   fn=.git/index
   size=$(stat --format=%s $fn)
   # offset of hash; use 32 in a sha256 repo!
   hash=$((size - 20))
   # the computed hash
   dd if=$fn bs=1 count=$hash | sha1sum
   # what the file records
   dd if=$fn bs=1 skip=$hash | od -A none -t x1 | tr -d ' \n'

Which admittedly is kind of horrible, but this isn't generally needed
much outside of debugging.

-Peff

```
