]> Kevux Git Server - rit/commit
rust: add a hash algorithm abstraction
authorbrian m. carlson <sandals@crustytoothpaste.net>
Sat, 7 Feb 2026 20:04:35 +0000 (20:04 +0000)
committerJunio C Hamano <gitster@pobox.com>
Sun, 8 Feb 2026 01:41:01 +0000 (17:41 -0800)
commite25c7c9393625df7f3f0596ebe79602afe3b5f7f
treeafee4a303770b2f23d4c2bdb66409b1046827dc8
parentb674d1036a3a82aaccfd5586007006f1f08648ef
rust: add a hash algorithm abstraction

This works very similarly to the existing one in C except that it
doesn't provide any functionality to hash an object.  We don't currently
need that right now, but the use of those function pointers do make it
substantially more difficult to write a bit-for-bit identical structure
across the C/Rust interface, so omit them for now.

Instead of the more customary "&self", use "self", because the former is
the size of a pointer and the latter is the size of an integer on most
systems.  Don't define an unknown value but use an Option for that
instead.

Update the object ID structure to allow slicing the data appropriately
for the algorithm.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
src/hash.rs