|
@@ -41,7 +41,7 @@ type ShakeHash interface {
|
|
|
|
|
|
|
|
// cSHAKE specific context
|
|
// cSHAKE specific context
|
|
|
type cshakeState struct {
|
|
type cshakeState struct {
|
|
|
- state // SHA-3 state context and Read/Write operations
|
|
|
|
|
|
|
+ *state // SHA-3 state context and Read/Write operations
|
|
|
|
|
|
|
|
// initBlock is the cSHAKE specific initialization set of bytes. It is initialized
|
|
// initBlock is the cSHAKE specific initialization set of bytes. It is initialized
|
|
|
// by newCShake function and stores concatenation of N followed by S, encoded
|
|
// by newCShake function and stores concatenation of N followed by S, encoded
|
|
@@ -82,7 +82,7 @@ func leftEncode(value uint64) []byte {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func newCShake(N, S []byte, rate int, dsbyte byte) ShakeHash {
|
|
func newCShake(N, S []byte, rate int, dsbyte byte) ShakeHash {
|
|
|
- c := cshakeState{state: state{rate: rate, dsbyte: dsbyte}}
|
|
|
|
|
|
|
+ c := cshakeState{state: &state{rate: rate, dsbyte: dsbyte}}
|
|
|
|
|
|
|
|
// leftEncode returns max 9 bytes
|
|
// leftEncode returns max 9 bytes
|
|
|
c.initBlock = make([]byte, 0, 9*2+len(N)+len(S))
|
|
c.initBlock = make([]byte, 0, 9*2+len(N)+len(S))
|
|
@@ -104,7 +104,7 @@ func (c *cshakeState) Reset() {
|
|
|
func (c *cshakeState) Clone() ShakeHash {
|
|
func (c *cshakeState) Clone() ShakeHash {
|
|
|
b := make([]byte, len(c.initBlock))
|
|
b := make([]byte, len(c.initBlock))
|
|
|
copy(b, c.initBlock)
|
|
copy(b, c.initBlock)
|
|
|
- return &cshakeState{state: *c.clone(), initBlock: b}
|
|
|
|
|
|
|
+ return &cshakeState{state: c.clone(), initBlock: b}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// Clone returns copy of SHAKE context within its current state.
|
|
// Clone returns copy of SHAKE context within its current state.
|