Commit Graph
14 Commits
Author SHA1 Message Date
Martin Hamrle 077efaa604 x/crypto: fix typos
The typos were found by misspell tool.

Change-Id: I120740f12f7ba48330749ebf84050a7b98e01016
Reviewed-on: https://go-review.googlesource.com/24725
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
2016-07-06 16:40:51 +00:00
Lynn Boger fbbbdbdd6f sha3: revert alignment optimization on ppc64
A previous fix to improve performance based on alignment
to sha3 was made in both ppc64le and ppc64, when it should
have only applied to ppc64le.  This changes the build tags
so it is only done for ppc64le.

Fixes golang/go#15392

Change-Id: Idf32a0370f3c76fc2b54a2897a668acbae5d43c5
Reviewed-on: https://go-review.googlesource.com/22323
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-04-20 21:40:36 +00:00
Lynn Boger c197bcf24c golang/x/crypto/sha3: use better alignment
Change the build tags for xor.go and xor_unaligned.go
to perform better on ppc64/ppc64le.

This improves performance for these sha3 benchmarks:

benchmark                        old MB/s     new MB/s     speedup
BenchmarkSha3_512_MTU            68.42        76.03        1.11x
BenchmarkSha3_384_MTU            91.12        105.38       1.16x
BenchmarkSha3_256_MTU            110.19       132.63       1.20x
BenchmarkSha3_224_MTU            114.46       139.12       1.22x
BenchmarkShake128_MTU            129.77       163.14       1.26x
BenchmarkShake256_MTU            125.01       151.93       1.22x
BenchmarkShake256_16x            110.60       129.44       1.17x
BenchmarkShake256_1MiB           128.51       154.23       1.20x
BenchmarkSha3_512_1MiB           74.18        82.39        1.11x

Fixes golang/go#14847

Change-Id: I59ba763b4eaf3e567399b132ad820fb2dcbbf129
Reviewed-on: https://go-review.googlesource.com/20821
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-17 20:21:02 +00:00
Glenn Brown bc65b9074c sha3: fix TestAppend to loop twice, to match the comments.
Change-Id: I84713a4173d9de4cd3d14991b8a47c9fbae7dcfd
Reviewed-on: https://go-review.googlesource.com/8976
Reviewed-by: David Symonds <dsymonds@golang.org>
2015-04-16 05:37:58 +00:00
David Leon Gil bfc286917c sha3: move test data to testdata
Change the location of the KAT data for consistency with
other packages.

Change-Id: Ica10ad7d1730603f957fb413e28fe771b3c323bc
Reviewed-on: https://go-review.googlesource.com/3267
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-01-24 22:04:49 +00:00
David Leon Gil 4ed45ec682 sha3: use unaligned reads and xors on x86 and x64
Speedup of about 1.4x on x64. Added benchmarks that use the
ShakeHash interface, which doesn't require copying the state.

Unaligned or generic xorIn and copyOut functions chosen via
buildline, but both are tested.

Substantial contributions from Eric Eisner.

See golang.org/cl/151630044 for the previous CR.

(There are also some minor edits/additions to the documentation.)

Change-Id: I9500c25682457c82487512b9b8c66df7d75bff5d
Reviewed-on: https://go-review.googlesource.com/2132
Reviewed-by: Adam Langley <agl@golang.org>
2015-01-12 22:01:33 +00:00
David Symonds 1fbbd62cfe crypto: add import comments.
Change-Id: I33240faf1b8620d0cd600de661928d8e422ebdbc
Reviewed-on: https://go-review.googlesource.com/1235
Reviewed-by: Andrew Gerrand <adg@golang.org>
2014-12-09 23:26:36 +00:00
Ian Lance Taylor cb7a96fa34 sha3: change range statement in test to work with Go 1.3 and earlier
LGTM=bradfitz
R=agl, bradfitz
CC=golang-codereviews
https://golang.org/cl/157930043
2014-10-13 14:14:22 -07:00
Eric Roshan-Eisner 9b55b542f6 go.crypto/sha3: optimize round function
benchmark                        old ns/op     new ns/op     delta
BenchmarkPermutationFunction     1128          733           -35.02%
BenchmarkShake256_1MiB           10004381      6832715       -31.70%

benchmark                        old MB/s     new MB/s     speedup
BenchmarkPermutationFunction     177.23       272.54       1.54x
BenchmarkShake256_1MiB           104.81       153.46       1.46x

LGTM=agl
R=golang-codereviews, agl
CC=golang-codereviews
https://golang.org/cl/156770043
2014-10-08 10:57:02 -07:00
Adam Langley 82442e0e95 go.crypto/sha3: use the go1.4 tag to register the hash functions.
Prior to Go 1.4, crypto didn't have the consts defined for SHA-3.

LGTM=bradfitz
R=bradfitz
CC=golang-codereviews
https://golang.org/cl/133540043
2014-09-03 16:08:25 -07:00
David Leon Gil 1b32d8b50a go.crypto/sha3: update to sync with draft FIPS-202
1. API:

This exposes a minimal API: the SHA-3 functions implement hash.Hash. The
SHAKE functions implement a new "ShakeHash" interface that implements
io.Reader, io.Writer, and Reset().

(The previous Barrier() function has been removed.)

(Alternative proposal: Don't implement io.Reader, but instead provide a
"Digest(d []byte) error" function that performs a hash.Hash style copy.
Somewhat more minimal, but very easy to use incorrectly.)

2. Tests

Added the complete set of ShortMsgKATs from
   https://github.com/gvanas/KeccakCodePackage

3. Correctness

In sync with draft FIPS-202.

4. Documentation

A summary of the security properties of the SHA-3 and SHAKE functions is
provided in doc.go; some concrete recommendations as well.

Fixes 8563.

R=golang-codereviews, agl
CC=golang-codereviews
https://golang.org/cl/130950043
2014-09-03 12:04:00 -07:00
Eric Roshan-Eisner d52ec73510 go.crypto/sha3: change keccakF to stateless function
Taken from my implementation: https://bitbucket.org/ede/sha3
Performance gain from using less memory and more registers.

benchmark                       old ns/op    new ns/op    delta
BenchmarkPermutationFunction         1484         1118  -24.66%
BenchmarkBulkKeccak512             374993       295178  -21.28%
BenchmarkBulkKeccak256             215496       172335  -20.03%

benchmark                        old MB/s     new MB/s  speedup
BenchmarkPermutationFunction       134.76       178.80    1.33x
BenchmarkBulkKeccak512              43.69        55.51    1.27x
BenchmarkBulkKeccak256              76.03        95.07    1.25x

R=jcb, agl
CC=golang-dev, nigeltao
https://golang.org/cl/8088044
2013-04-02 10:41:35 -04:00
Nigel Tao 44f6c2e4a2 go.crypto/sha3: fix typo; remove 4 million map lookups (5% of "go test"
time); delete some comments that didn't add much and were incorrect
anyway (the test specification was tc, not t).

R=jcb
CC=agl, golang-dev
https://golang.org/cl/7665045
2013-03-23 10:10:15 +11:00
Joseph Bonneau 0bc0bccba9 go.crypto/sha3: new package
Added a pure Go implementation of SHA3 (Keccak) which implements the hash.Hash interface.
A test file is included with performance benchmarks and standard test vectors.

R=agl, nigeltao
CC=golang-dev
https://golang.org/cl/7760044
2013-03-22 14:59:59 -04:00