diff options
author | obscuren <geffobscura@gmail.com> | 2015-06-10 03:12:25 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-06-10 03:12:25 +0800 |
commit | bac9a94ddf20dc530966cbf6cd384aaf94aedc77 (patch) | |
tree | 0ced967e60315698cc5056a984d7678c417bc1ce /crypto/sha3/sha3.go | |
parent | 0e703d92ac9df61e2ededa8c895c70ded101a607 (diff) | |
parent | 14994fa21bf6f05554ff370d41005d06b68d20a5 (diff) | |
download | go-tangerine-bac9a94ddf20dc530966cbf6cd384aaf94aedc77.tar.gz go-tangerine-bac9a94ddf20dc530966cbf6cd384aaf94aedc77.tar.zst go-tangerine-bac9a94ddf20dc530966cbf6cd384aaf94aedc77.zip |
Merge branch 'release/0.9.28'v0.9.28
Diffstat (limited to 'crypto/sha3/sha3.go')
-rw-r--r-- | crypto/sha3/sha3.go | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/crypto/sha3/sha3.go b/crypto/sha3/sha3.go index 22df0ef11..6b058ae4d 100644 --- a/crypto/sha3/sha3.go +++ b/crypto/sha3/sha3.go @@ -38,13 +38,10 @@ const stateSize = laneSize * numLanes // O(2^{outputSize/2}) computations (the birthday lower bound). Future standards may modify the // capacity/outputSize ratio to allow for more output with lower cryptographic security. type digest struct { - a [numLanes]uint64 // main state of the hash - b [numLanes]uint64 // intermediate states - c [sliceSize]uint64 // intermediate states - d [sliceSize]uint64 // intermediate states - outputSize int // desired output size in bytes - capacity int // number of bytes to leave untouched during squeeze/absorb - absorbed int // number of bytes absorbed thus far + a [numLanes]uint64 // main state of the hash + outputSize int // desired output size in bytes + capacity int // number of bytes to leave untouched during squeeze/absorb + absorbed int // number of bytes absorbed thus far } // minInt returns the lesser of two integer arguments, to simplify the absorption routine. @@ -116,7 +113,7 @@ func (d *digest) Write(p []byte) (int, error) { // For every rate() bytes absorbed, the state must be permuted via the F Function. if (d.absorbed)%d.rate() == 0 { - d.keccakF() + keccakF1600(&d.a) } } @@ -134,7 +131,7 @@ func (d *digest) Write(p []byte) (int, error) { d.absorbed += (lastLane - firstLane) * laneSize // For every rate() bytes absorbed, the state must be permuted via the F Function. if (d.absorbed)%d.rate() == 0 { - d.keccakF() + keccakF1600(&d.a) } offset = 0 @@ -167,7 +164,7 @@ func (d *digest) pad() { // finalize prepares the hash to output data by padding and one final permutation of the state. func (d *digest) finalize() { d.pad() - d.keccakF() + keccakF1600(&d.a) } // squeeze outputs an arbitrary number of bytes from the hash state. @@ -192,7 +189,7 @@ func (d *digest) squeeze(in []byte, toSqueeze int) []byte { out = out[laneSize:] } if len(out) > 0 { - d.keccakF() + keccakF1600(&d.a) } } return in[:len(in)+toSqueeze] // Re-slice in case we wrote extra data. |