mirror of
https://github.com/emmansun/gmsm.git
synced 2025-04-26 12:16:20 +08:00
zuc: add comment and fix a bug
This commit is contained in:
parent
7e81d05ce9
commit
1a75fd65ca
@ -117,7 +117,7 @@ func New() hash.Hash {
|
||||
return d
|
||||
}
|
||||
|
||||
// Sum appends the current hash to b and returns the resulting slice.
|
||||
// Sum appends the current hash to in and returns the resulting slice.
|
||||
// It does not change the underlying hash state.
|
||||
func (d *digest) Sum(in []byte) []byte {
|
||||
// Make a copy of d so that caller can keep writing and summing.
|
||||
|
@ -206,6 +206,8 @@ func (m *ZUC128Mac) Finish(p []byte, nbits int) []byte {
|
||||
return digest[:]
|
||||
}
|
||||
|
||||
// Sum appends the current hash to in and returns the resulting slice.
|
||||
// It does not change the underlying hash state.
|
||||
func (m *ZUC128Mac) Sum(in []byte) []byte {
|
||||
// Make a copy of d so that caller can keep writing and summing.
|
||||
d0 := *m
|
||||
|
@ -231,9 +231,13 @@ func (m *ZUC256Mac) Finish(p []byte, nbits int) []byte {
|
||||
return digest[:]
|
||||
}
|
||||
|
||||
// Sum appends the current hash to in and returns the resulting slice.
|
||||
// It does not change the underlying hash state.
|
||||
func (m *ZUC256Mac) Sum(in []byte) []byte {
|
||||
// Make a copy of d so that caller can keep writing and summing.
|
||||
d0 := *m
|
||||
d0.t = make([]uint32, len(m.t))
|
||||
copy(d0.t, m.t)
|
||||
hash := d0.checkSum(0, 0)
|
||||
return append(in, hash[:]...)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user