From 37649b7f809f14b78d178c32e4d8333243f1f74e Mon Sep 17 00:00:00 2001 From: "brian m. carlson" Date: Wed, 14 Nov 2018 04:09:34 +0000 Subject: t/helper: add a test helper to compute hash speed Add a utility (which is less for the testsuite and more for developers) that can compute hash speeds for whatever hash algorithms are implemented. This allows developers to test their personal systems to determine the performance characteristics of various algorithms. Signed-off-by: brian m. carlson Signed-off-by: Junio C Hamano --- t/helper/test-tool.c | 1 + 1 file changed, 1 insertion(+) (limited to 't/helper/test-tool.c') diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c index 6b5836dc1b..e009c8186d 100644 --- a/t/helper/test-tool.c +++ b/t/helper/test-tool.c @@ -20,6 +20,7 @@ static struct test_cmd cmds[] = { { "example-decorate", cmd__example_decorate }, { "genrandom", cmd__genrandom }, { "hashmap", cmd__hashmap }, + { "hash-speed", cmd__hash_speed }, { "index-version", cmd__index_version }, { "json-writer", cmd__json_writer }, { "lazy-init-name-hash", cmd__lazy_init_name_hash }, -- cgit v1.2.3 From 13eeedb5d17ca3539600b6618d103b652ecc8ab0 Mon Sep 17 00:00:00 2001 From: "brian m. carlson" Date: Wed, 14 Nov 2018 04:09:36 +0000 Subject: Add a base implementation of SHA-256 support SHA-1 is weak and we need to transition to a new hash function. For some time, we have referred to this new function as NewHash. Recently, we decided to pick SHA-256 as NewHash. The reasons behind the choice of SHA-256 are outlined in the thread starting at [1] and in the commit history for the hash function transition document. Add a basic implementation of SHA-256 based off libtomcrypt, which is in the public domain. Optimize it and restructure it to meet our coding standards. Pull in the update and final functions from the SHA-1 block implementation, as we know these function correctly with all compilers. This implementation is slower than SHA-1, but more performant implementations will be introduced in future commits. Wire up SHA-256 in the list of hash algorithms, and add a test that the algorithm works correctly. Note that with this patch, it is still not possible to switch to using SHA-256 in Git. Additional patches are needed to prepare the code to handle a larger hash algorithm and further test fixes are needed. [1] https://public-inbox.org/git/20180609224913.GC38834@genre.crustytoothpaste.net/ Signed-off-by: brian m. carlson Signed-off-by: Junio C Hamano --- t/helper/test-tool.c | 1 + 1 file changed, 1 insertion(+) (limited to 't/helper/test-tool.c') diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c index e009c8186d..2a65193514 100644 --- a/t/helper/test-tool.c +++ b/t/helper/test-tool.c @@ -43,6 +43,7 @@ static struct test_cmd cmds[] = { { "scrap-cache-tree", cmd__scrap_cache_tree }, { "sha1", cmd__sha1 }, { "sha1-array", cmd__sha1_array }, + { "sha256", cmd__sha256 }, { "sigchain", cmd__sigchain }, { "strcmp-offset", cmd__strcmp_offset }, { "string-list", cmd__string_list }, -- cgit v1.2.3