A new hash algorithm for Git
A new hash algorithm for Git
Posted Feb 3, 2020 18:37 UTC (Mon) by Cyberax (✭ supporter ✭, #52523)Parent article: A new hash algorithm for Git
One trick that worked for me in a similar case was to switch the encoding. SHA-1 is encoded as hex numbers, we can simply switch SHA-256 to be encoded as letters "g" to "v", so they will be immediately recognizable.
A new hash algorithm for Git
Posted Feb 3, 2020 18:41 UTC (Mon)
by juliank (guest, #45896)
[Link] (14 responses)
Posted Feb 3, 2020 18:41 UTC (Mon) by juliank (guest, #45896) [Link] (14 responses)
A new hash algorithm for Git
Posted Feb 3, 2020 23:48 UTC (Mon)
by dsommers (subscriber, #55274)
[Link] (13 responses)
Posted Feb 3, 2020 23:48 UTC (Mon) by dsommers (subscriber, #55274) [Link] (13 responses)
* performance: Doing char replacing in strings is more CPU intensive than just skipping one single byte and continue using standard functions/libraries. This gets more evident when when considering large repositories like the Linux kernel.
* future compatibility: Shifting a-f chars to another set of 6 other letters will only work 3 more times if only considering lower case letters - 6 letters (a-f) * 4 shifts = 24. So at the 5 change, something new must be done to avoid breaking compatibility. Of course the counter argument is "how often will such new algorithms occur in reality?"; but none of us really knows that for sure - just as we don't know how long a git repository will live and be accessed.
From this article (I've not paid attention to discussions in the git community), it seems like they account for the possibility change it again later on again. So having a prefix possibility with just one prefix or suffix letter makes it possible to change algorithms 26 times, with no performance loss (except the "skip one byte" operation when evaluating the hash). If that is two little, 3 letters gives the possibility for 17576 changes; which is probably enough for most of us alive today - but using 4 letters increases that once again to an even more insane number.
But say you then settle for 4 letters prefix (456.976 possibilities) ... then you're not that far away from {sha256} which is 8 letters, with basically an unlimited amount of algorithm changes. What is inside the {} can be any length while containing a good description of what kind of algorithm in use, without needing to lookup that "AAAC" means SHA512.
A new hash algorithm for Git
Posted Feb 4, 2020 0:10 UTC (Tue)
by Cyberax (✭ supporter ✭, #52523)
[Link]
Posted Feb 4, 2020 0:10 UTC (Tue) by Cyberax (✭ supporter ✭, #52523) [Link]
A new hash algorithm for Git
Posted Feb 4, 2020 5:56 UTC (Tue)
by eru (subscriber, #2753)
[Link] (4 responses)
Posted Feb 4, 2020 5:56 UTC (Tue) by eru (subscriber, #2753) [Link] (4 responses)
But probably that would be enough, it is unlikely the hash changes more than once in a decade...
A new hash algorithm for Git
Posted Feb 4, 2020 6:06 UTC (Tue)
by Cyberax (✭ supporter ✭, #52523)
[Link]
Posted Feb 4, 2020 6:06 UTC (Tue) by Cyberax (✭ supporter ✭, #52523) [Link]
A new hash algorithm for Git
Posted Feb 4, 2020 16:07 UTC (Tue)
by mathstuf (subscriber, #69389)
[Link] (2 responses)
Posted Feb 4, 2020 16:07 UTC (Tue) by mathstuf (subscriber, #69389) [Link] (2 responses)
A new hash algorithm for Git
Posted Feb 5, 2020 2:56 UTC (Wed)
by NYKevin (subscriber, #129325)
[Link] (1 responses)
Posted Feb 5, 2020 2:56 UTC (Wed) by NYKevin (subscriber, #129325) [Link] (1 responses)
A new hash algorithm for Git
Posted Feb 5, 2020 3:32 UTC (Wed)
by Cyberax (✭ supporter ✭, #52523)
[Link]
Posted Feb 5, 2020 3:32 UTC (Wed) by Cyberax (✭ supporter ✭, #52523) [Link]
> That'd be entertaining to watch.
Why?
A new hash algorithm for Git
Posted Feb 4, 2020 19:40 UTC (Tue)
by quotemstr (subscriber, #45331)
[Link]
Posted Feb 4, 2020 19:40 UTC (Tue) by quotemstr (subscriber, #45331) [Link]
Hash functions don't operate on the hex encoding of the hash digest. If you need to parse base-16 to binary anyway, there's no penalty arising from choosing an alternate set of characters to represent that base-16 value.
A new hash algorithm for Git
Posted Feb 5, 2020 15:00 UTC (Wed)
by obi (guest, #5784)
[Link] (5 responses)
Posted Feb 5, 2020 15:00 UTC (Wed) by obi (guest, #5784) [Link] (5 responses)
A new hash algorithm for Git
Posted Feb 5, 2020 17:26 UTC (Wed)
by juliank (guest, #45896)
[Link]
Posted Feb 5, 2020 17:26 UTC (Wed) by juliank (guest, #45896) [Link]
A new hash algorithm for Git
Posted Feb 6, 2020 0:41 UTC (Thu)
by pj (subscriber, #4506)
[Link] (2 responses)
Posted Feb 6, 2020 0:41 UTC (Thu) by pj (subscriber, #4506) [Link] (2 responses)
A new hash algorithm for Git
Posted Feb 7, 2020 22:14 UTC (Fri)
by Jandar (subscriber, #85683)
[Link] (1 responses)
Posted Feb 7, 2020 22:14 UTC (Fri) by Jandar (subscriber, #85683) [Link] (1 responses)
A new hash algorithm for Git
Posted Feb 7, 2020 23:17 UTC (Fri)
by Jandar (subscriber, #85683)
[Link]
Posted Feb 7, 2020 23:17 UTC (Fri) by Jandar (subscriber, #85683) [Link]
The hash is like an inode-number for a file.
A new hash algorithm for Git
Posted Feb 6, 2020 9:50 UTC (Thu)
by ivyl (subscriber, #88764)
[Link]
Posted Feb 6, 2020 9:50 UTC (Thu) by ivyl (subscriber, #88764) [Link]
A new hash algorithm for Git
Posted Feb 3, 2020 21:44 UTC (Mon)
by josh (subscriber, #17465)
[Link] (2 responses)
Posted Feb 3, 2020 21:44 UTC (Mon) by josh (subscriber, #17465) [Link] (2 responses)
A new hash algorithm for Git
Posted Feb 4, 2020 17:13 UTC (Tue)
by excors (subscriber, #95769)
[Link] (1 responses)
Posted Feb 4, 2020 17:13 UTC (Tue) by excors (subscriber, #95769) [Link] (1 responses)
A new hash algorithm for Git
Posted Feb 5, 2020 11:55 UTC (Wed)
by mgedmin (subscriber, #34497)
[Link]
Posted Feb 5, 2020 11:55 UTC (Wed) by mgedmin (subscriber, #34497) [Link]
A new hash algorithm for Git
Posted Feb 4, 2020 14:58 UTC (Tue)
by ballombe (subscriber, #9523)
[Link] (1 responses)
Posted Feb 4, 2020 14:58 UTC (Tue) by ballombe (subscriber, #9523) [Link] (1 responses)
12345678 is perfectly valid in both notation.
A new hash algorithm for Git
Posted Feb 4, 2020 15:51 UTC (Tue)
by willy (subscriber, #9762)
[Link]
Posted Feb 4, 2020 15:51 UTC (Tue) by willy (subscriber, #9762) [Link]
A new hash algorithm for Git
Posted Feb 4, 2020 23:09 UTC (Tue)
by flussence (guest, #85566)
[Link]
Posted Feb 4, 2020 23:09 UTC (Tue) by flussence (guest, #85566) [Link]