Question: how will sha256sum be implemented in git
- From
Aditya Garg <gargaditya08@live.com>
- Date
- Jul 4, 2025, 11:18 UTC
- Message-ID
- <PN3PR01MB9597524FAEAA3B26B15804B9B842A@PN3PR01MB9597.INDPRD01.PROD.OUTLOOK.COM>
Hi all
I just read that git aims to transition to SHA256 by default, and conversion from SHA1 to SHA256 is needed for old repos. I was just curious how will that be achieved.
Dumb idea, but maybe we can just encode the existing SHA1 sums' string to SHA256?
Eg:
$ echo -n 8994f255af5451b6cd1db01ee16d8cf15b9df81e | sha256sum bf8d6d915848377db81ee47e883c0a683b3d86a49ab120191ea1c3d76a30c33f *-
so bf8d6d915848377db81ee47e883c0a683b3d86a49ab120191ea1c3d76a30c33f will be our new commit hash.
I think we can do that since sha256sum is chosen due to negligible collisions right?