[openpgp] SHA-x performance (was: SHA3 algorithm ids)

Werner Koch <wk@gnupg.org> Tue, 11 August 2015 17:30 UTC

Return-Path: <wk@gnupg.org>
X-Original-To: openpgp@ietfa.amsl.com
Delivered-To: openpgp@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com []) by ietfa.amsl.com (Postfix) with ESMTP id 6AD401ACE06 for <openpgp@ietfa.amsl.com>; Tue, 11 Aug 2015 10:30:34 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.9
X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5 tests=[BAYES_00=-1.9] autolearn=ham
Received: from mail.ietf.org ([]) by localhost (ietfa.amsl.com []) (amavisd-new, port 10024) with ESMTP id WoeKXmBn9LIV for <openpgp@ietfa.amsl.com>; Tue, 11 Aug 2015 10:30:33 -0700 (PDT)
Received: from kerckhoffs.g10code.com (kerckhoffs.g10code.com [IPv6:2001:aa8:fff1:100::22]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 52A221ACDFF for <openpgp@ietf.org>; Tue, 11 Aug 2015 10:30:33 -0700 (PDT)
Received: from uucp by kerckhoffs.g10code.com with local-rmail (Exim 4.80 #2 (Debian)) id 1ZPDNf-0002g4-HH for <openpgp@ietf.org>; Tue, 11 Aug 2015 19:30:31 +0200
Received: from wk by vigenere.g10code.de with local (Exim 4.84 #3 (Debian)) id 1ZPDMp-0002Px-QV; Tue, 11 Aug 2015 19:29:39 +0200
From: Werner Koch <wk@gnupg.org>
To: Peter Gutmann <pgut001@cs.auckland.ac.nz>
References: <87y4hmi19i.fsf@vigenere.g10code.de> <7540C7A9-2830-4A63-8310-B684796DA279@nohats.ca> <55C681FC.9010100@iang.org> <sjma8tztbgo.fsf@securerf.ihtfp.org> <CAMm+Lwj7SxXTn+KD-eQSeZHwJB36tCgD1t0bodVsp3ovOaZ8mw@mail.gmail.com> <9A043F3CF02CD34C8E74AC1594475C73F4AD7C72@uxcn10-5.UoA.auckland.ac.nz> <87io8lpzu4.fsf@alice.fifthhorseman.net> <9A043F3CF02CD34C8E74AC1594475C73F4AD7F8E@uxcn10-5.UoA.auckland.ac.nz>
Organisation: g10 Code GmbH
X-message-flag: Mails containing HTML will not be read! Please send only plain text.
OpenPGP: id=F2AD85AC1E42B367; url=finger:wk@g10code.com
Mail-Followup-To: Peter Gutmann <pgut001@cs.auckland.ac.nz>, Daniel Kahn Gillmor <dkg@fifthhorseman.net>, Phillip Hallam-Baker <phill@hallambaker.com>, Derek Atkins <derek@ihtfp.com>, IETF OpenPGP <openpgp@ietf.org>, ianG <iang@iang.org>
Date: Tue, 11 Aug 2015 19:29:39 +0200
In-Reply-To: <9A043F3CF02CD34C8E74AC1594475C73F4AD7F8E@uxcn10-5.UoA.auckland.ac.nz> (Peter Gutmann's message of "Tue, 11 Aug 2015 16:39:21 +0000")
Message-ID: <87mvxxenss.fsf_-_@vigenere.g10code.de>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Archived-At: <http://mailarchive.ietf.org/arch/msg/openpgp/OLUKN_3upy6wogLXVydNdu57yqE>
Cc: Phillip Hallam-Baker <phill@hallambaker.com>, Derek Atkins <derek@ihtfp.com>, ianG <iang@iang.org>, Daniel Kahn Gillmor <dkg@fifthhorseman.net>, IETF OpenPGP <openpgp@ietf.org>
Subject: [openpgp] SHA-x performance (was: SHA3 algorithm ids)
X-BeenThere: openpgp@ietf.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: "Ongoing discussion of OpenPGP issues." <openpgp.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/openpgp>, <mailto:openpgp-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/openpgp/>
List-Post: <mailto:openpgp@ietf.org>
List-Help: <mailto:openpgp-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/openpgp>, <mailto:openpgp-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 11 Aug 2015 17:30:34 -0000

On Tue, 11 Aug 2015 18:39, pgut001@cs.auckland.ac.nz said:

> A huge number of devices, and in particular ones with less CPU power, are
> still 32-bit, and will remain so for a long time, probably more or less
> indefinitely.

Does anyone know a summary of SHA-256 performance on standard CPUs
with dedicated SHA hardware?  The Padlock engine has this but I don't
know whether other CPUs also provide hardware support.  I assume that on
x86 the AVX instructions are as good as dedicated support:

FWIW, Libgcrypt on an i5-2410M (64 bit) gives this:

                |  nanosecs/byte   mebibytes/sec   cycles/byte
 SHA1           |      1.92 ns/B     496.5 MiB/s      4.42 c/B
 SHA256         |      4.42 ns/B     215.6 MiB/s     10.17 c/B
 SHA512         |      2.97 ns/B     321.1 MiB/s      6.83 c/B

with AVX disabled:

 SHA1           |      2.27 ns/B     419.7 MiB/s      5.23 c/B
 SHA256         |      5.26 ns/B     181.1 MiB/s     12.11 c/B
 SHA512         |      3.61 ns/B     264.0 MiB/s      8.31 c/B

with AVX and SSSE3 disabled:

 SHA1           |      3.27 ns/B     292.0 MiB/s      7.51 c/B
 SHA256         |      7.50 ns/B     127.1 MiB/s     17.26 c/B
 SHA512         |      4.68 ns/B     203.6 MiB/s     10.78 c/B

We have no optimized SHA3 yet; for reference here are the numbers from
the unoptimized version:

 SHA3-256       |      5.70 ns/B     167.3 MiB/s     13.11 c/B
 SHA3-512       |     10.66 ns/B     89.46 MiB/s     24.52 c/B



Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.