git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 00/12] Base SHA-256 algorithm implementation
@ 2018-08-29  0:58 brian m. carlson
  2018-08-29  0:58 ` [RFC PATCH 01/12] sha1-file: rename algorithm to "sha1" brian m. carlson
                   ` (12 more replies)
  0 siblings, 13 replies; 24+ messages in thread
From: brian m. carlson @ 2018-08-29  0:58 UTC (permalink / raw)
  To: git

This RFC series provides an actual SHA-256 implementation and wires it
up, along with a few housekeeping patches to make it usable for testing.

As discussed in some threads, this changes the algorithm name from
"sha-1" to "sha1" (and also adds "sha256") because it's far easier to
type.

I introduced some basic tests for the hash algorithms in use.  Since I
did not import the SHA-256 implementation verbatim, I felt it was
necessary to ensure that the hash algorithm implementations continued to
function as expected.  My main changes were to adjust the code to use
our endianness functions, to adopt something closer to our style, and to
make use of memcpy and friends for performance reasons.

I opted to place all the implementation code for SHA-256 into one
directory, as opposed to the various directories we have for the SHA-1
implementations, mostly for tidiness and ease of use.

I wired up OpenSSL because we already have it and libgcrypt because it
performs better than SHA-1.  I didn't provide an implementation for
SHA-1 with libgcrypt because everybody should be using SHA1DC for
security.

I didn't provide an implementation based on libnettle because its x86-64
assembly implementation isn't vectorized and is pretty slow.  Since this
was written before I had access to a Mac, Apple Common Crypto hasn't
been wired up, either.  Patches welcome.

If libgit2 would like to import this SHA-256 implementation, they're
welcome to do so under their normal license terms.  If not, that's fine,
too.

brian m. carlson (12):
  sha1-file: rename algorithm to "sha1"
  sha1-file: provide functions to look up hash algorithms
  hex: introduce functions to print arbitrary hashes
  t: add basic tests for our SHA-1 implementation
  t: make the sha1 test-tool helper generic
  sha1-file: add a constant for hash block size
  t/helper: add a test helper to compute hash speed
  commit-graph: convert to using the_hash_algo
  Add a base implementation of SHA-256 support
  sha256: add an SHA-256 implementation using libgcrypt
  hash: add an SHA-256 implementation using OpenSSL
  commit-graph: specify OID version for SHA-256

 Makefile                              |  22 ++++
 cache.h                               |  28 ++--
 commit-graph.c                        |  38 +++---
 hash.h                                |  41 +++++-
 hex.c                                 |  32 +++--
 sha1-file.c                           |  70 +++++++++-
 sha256/block/sha256.c                 | 180 ++++++++++++++++++++++++++
 sha256/block/sha256.h                 |  26 ++++
 sha256/gcrypt.h                       |  30 +++++
 t/helper/test-hash-speed.c            |  61 +++++++++
 t/helper/{test-sha1.c => test-hash.c} |  19 +--
 t/helper/test-sha1.c                  |  52 +-------
 t/helper/test-sha256.c                |   7 +
 t/helper/test-tool.c                  |   2 +
 t/helper/test-tool.h                  |   4 +
 t/t0014-hash.sh                       |  54 ++++++++
 16 files changed, 573 insertions(+), 93 deletions(-)
 create mode 100644 sha256/block/sha256.c
 create mode 100644 sha256/block/sha256.h
 create mode 100644 sha256/gcrypt.h
 create mode 100644 t/helper/test-hash-speed.c
 copy t/helper/{test-sha1.c => test-hash.c} (66%)
 create mode 100644 t/helper/test-sha256.c
 create mode 100755 t/t0014-hash.sh


^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2018-09-03 19:11 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-29  0:58 [RFC PATCH 00/12] Base SHA-256 algorithm implementation brian m. carlson
2018-08-29  0:58 ` [RFC PATCH 01/12] sha1-file: rename algorithm to "sha1" brian m. carlson
2018-08-29  0:58 ` [RFC PATCH 02/12] sha1-file: provide functions to look up hash algorithms brian m. carlson
2018-08-29  0:58 ` [RFC PATCH 03/12] hex: introduce functions to print arbitrary hashes brian m. carlson
2018-08-29  0:58 ` [RFC PATCH 04/12] t: add basic tests for our SHA-1 implementation brian m. carlson
2018-08-29  0:58 ` [RFC PATCH 05/12] t: make the sha1 test-tool helper generic brian m. carlson
2018-08-29  0:58 ` [RFC PATCH 06/12] sha1-file: add a constant for hash block size brian m. carlson
2018-08-29  0:58 ` [RFC PATCH 07/12] t/helper: add a test helper to compute hash speed brian m. carlson
2018-08-29  0:58 ` [RFC PATCH 08/12] commit-graph: convert to using the_hash_algo brian m. carlson
2018-08-29 12:41   ` Derrick Stolee
2018-08-30  2:30     ` brian m. carlson
2018-09-03 19:11     ` brian m. carlson
2018-08-29  0:58 ` [RFC PATCH 09/12] Add a base implementation of SHA-256 support brian m. carlson
2018-08-29  9:32   ` Ævar Arnfjörð Bjarmason
2018-08-29 23:55     ` brian m. carlson
2018-08-29 12:54   ` Derrick Stolee
2018-08-29  0:58 ` [RFC PATCH 10/12] sha256: add an SHA-256 implementation using libgcrypt brian m. carlson
2018-08-29  8:53   ` Ævar Arnfjörð Bjarmason
2018-08-29 23:39     ` brian m. carlson
2018-08-29  0:58 ` [RFC PATCH 11/12] hash: add an SHA-256 implementation using OpenSSL brian m. carlson
2018-08-29  0:58 ` [RFC PATCH 12/12] commit-graph: specify OID version for SHA-256 brian m. carlson
2018-08-29  9:37 ` [RFC PATCH 00/12] Base SHA-256 algorithm implementation Ævar Arnfjörð Bjarmason
2018-08-30  2:21   ` brian m. carlson
2018-08-30  2:41     ` brian m. carlson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).