git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "brian m. carlson" <sandals@crustytoothpaste.net>
To: git@vger.kernel.org
Subject: [RFC PATCH 00/12] Base SHA-256 algorithm implementation
Date: Wed, 29 Aug 2018 00:58:45 +0000	[thread overview]
Message-ID: <20180829005857.980820-1-sandals@crustytoothpaste.net> (raw)

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


             reply	other threads:[~2018-08-29  0:59 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-29  0:58 brian m. carlson [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180829005857.980820-1-sandals@crustytoothpaste.net \
    --to=sandals@crustytoothpaste.net \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).