]> Kevux Git Server - rit/commit
hash: add a function to look up hash algo structs
authorbrian m. carlson <sandals@crustytoothpaste.net>
Sat, 7 Feb 2026 20:04:36 +0000 (20:04 +0000)
committerJunio C Hamano <gitster@pobox.com>
Sun, 8 Feb 2026 01:41:01 +0000 (17:41 -0800)
commit9005b5bb72df521670db03eefeafe53c0a81f9a5
tree196e267f9b5a4fce74898538987bc8b9b1a6f545
parente25c7c9393625df7f3f0596ebe79602afe3b5f7f
hash: add a function to look up hash algo structs

In C, it's easy for us to look up a hash algorithm structure by its
offset by simply indexing the hash_algos array.  However, in Rust, we
sometimes need a pointer to pass to a C function, but we have our own
hash algorithm abstraction.

To get one from the other, let's provide a simple function that looks up
the C structure from the offset and expose it in Rust.

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