Граф коммитов

11 Коммитов

Автор SHA1 Сообщение Дата
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