From b29f4153e83623f24bebe99976e1368ef31bb008 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Thu, 21 May 2026 17:12:20 +0200 Subject: Add support for custom hash functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- librecrypt_hash_.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'librecrypt_hash_.c') diff --git a/librecrypt_hash_.c b/librecrypt_hash_.c index 8b1ab1d..89c8e88 100644 --- a/librecrypt_hash_.c +++ b/librecrypt_hash_.c @@ -119,12 +119,12 @@ next: prefix = 1u; /* $covered$ (TODO we currently don't have an algorithm to trigger this) */ } if (!algo->flexible_hash_size && prefix != n) - goto einval; /* $covered$ (TODO we currently don't have an algorithm to trigger this) */ + goto einval; /* TODO test with custom hash function */ /* Get hash size */ if (!algo->flexible_hash_size) { /* fixed */ - hash_size = algo->hash_size; /* $covered$ (TODO we currently don't have an algorithm to trigger this) */ + hash_size = algo->hash_size; /* TODO test with custom hash function */ } else if (prefix == n) { /* default */ hash_size = algo->hash_size; @@ -152,7 +152,7 @@ next: break; hash_size = i - prefix; if (algo->pad && algo->strict_pad) { - /* $covered{$ (TODO we currently don't have an algorithm to trigger this) */ + /* TODO test with custom hash function */ for (; i < n; i++) if (settings[i] != algo->pad) break; @@ -160,7 +160,6 @@ next: goto einval; if (i - prefix - hash_size >= 4u) goto einval; - /* $covered}$ */ } if (i != n) goto einval; @@ -242,7 +241,7 @@ next: ascii_len = hash_size % 3u; if (ascii_len) { if (algo->pad && algo->strict_pad) - ascii_len = 4u; /* padding to for bytes */ /* $covered$ (TODO we currently don't have an algorithm to trigger this) */ + ascii_len = 4u; /* padding to for bytes */ /* TODO test with custom hash function */ else ascii_len += 1u; /* 3n+m bytes: 4n+m+1 chars, unless m=0 */ } -- cgit v1.3.1