Functions
AppendBinary
method
#
func (d *Digest) AppendBinary(b []byte) ([]byte, error)
AppendBinary
method
#
func (s *SHAKE) AppendBinary(b []byte) ([]byte, error)
BlockSize
method
#
BlockSize returns the rate of sponge underlying this hash function.
func (d *Digest) BlockSize() int
BlockSize
method
#
func (s *SHAKE) BlockSize() int
Clone
method
#
func (d *Digest) Clone() *Digest
Clone
method
#
Clone returns a copy of the SHAKE context in its current state.
func (s *SHAKE) Clone() *SHAKE
MarshalBinary
method
#
func (d *Digest) MarshalBinary() ([]byte, error)
MarshalBinary
method
#
func (s *SHAKE) MarshalBinary() ([]byte, error)
New224
function
#
New224 returns a new Digest computing the SHA3-224 hash.
func New224() *Digest
New256
function
#
New256 returns a new Digest computing the SHA3-256 hash.
func New256() *Digest
New384
function
#
New384 returns a new Digest computing the SHA3-384 hash.
func New384() *Digest
New512
function
#
New512 returns a new Digest computing the SHA3-512 hash.
func New512() *Digest
NewCShake128
function
#
NewCShake128 creates a new cSHAKE128 XOF.
N is used to define functions based on cSHAKE, it can be empty when plain
cSHAKE is desired. S is a customization byte string used for domain
separation. When N and S are both empty, this is equivalent to NewShake128.
func NewCShake128(N []byte, S []byte) *SHAKE
NewCShake256
function
#
NewCShake256 creates a new cSHAKE256 XOF.
N is used to define functions based on cSHAKE, it can be empty when plain
cSHAKE is desired. S is a customization byte string used for domain
separation. When N and S are both empty, this is equivalent to NewShake256.
func NewCShake256(N []byte, S []byte) *SHAKE
NewLegacyKeccak256
function
#
NewLegacyKeccak256 returns a new Digest computing the legacy, non-standard
Keccak-256 hash.
func NewLegacyKeccak256() *Digest
NewLegacyKeccak512
function
#
NewLegacyKeccak512 returns a new Digest computing the legacy, non-standard
Keccak-512 hash.
func NewLegacyKeccak512() *Digest
NewShake128
function
#
NewShake128 creates a new SHAKE128 XOF.
func NewShake128() *SHAKE
NewShake256
function
#
NewShake256 creates a new SHAKE256 XOF.
func NewShake256() *SHAKE
Read
method
#
func (s *SHAKE) Read(out []byte) (n int, err error)
Reset
method
#
Reset resets the Digest to its initial state.
func (d *Digest) Reset()
Reset
method
#
Reset resets the hash to initial state.
func (s *SHAKE) Reset()
Size
method
#
func (s *SHAKE) Size() int
Size
method
#
Size returns the output size of the hash function in bytes.
func (d *Digest) Size() int
Sum
method
#
Sum appends the current hash to b and returns the resulting slice.
It does not change the underlying hash state.
func (d *Digest) Sum(b []byte) []byte
Sum
method
#
Sum appends a portion of output to b and returns the resulting slice. The
output length is selected to provide full-strength generic security: 32 bytes
for SHAKE128 and 64 bytes for SHAKE256. It does not change the underlying
state. It panics if any output has already been read.
func (s *SHAKE) Sum(in []byte) []byte
UnmarshalBinary
method
#
func (s *SHAKE) UnmarshalBinary(b []byte) error
UnmarshalBinary
method
#
func (d *Digest) UnmarshalBinary(b []byte) error
Write
method
#
Write absorbs more data into the hash's state.
It panics if any output has already been read.
func (s *SHAKE) Write(p []byte) (n int, err error)
Write
method
#
Write absorbs more data into the hash's state.
func (d *Digest) Write(p []byte) (n int, err error)
bytepad
function
#
func bytepad(data []byte, rate int) []byte
function
method
#
func (d *Digest) function() code
init
function
#
func init()
init
function
#
func init()
keccakF1600
function
#
func keccakF1600(a *[200]byte)
keccakF1600
function
#
go:noescape
func keccakF1600(a *[200]byte)
keccakF1600
function
#
func keccakF1600(a *[200]byte)
keccakF1600Generic
function
#
keccakF1600Generic applies the Keccak permutation.
func keccakF1600Generic(da *[200]byte)
kimd
function
#
kimd is a wrapper for the 'compute intermediate message digest' instruction.
src is absorbed into the sponge state a.
len(src) must be a multiple of the rate for the given function code.
go:noescape
func kimd(function code, a *[200]byte, src []byte)
klmd
function
#
klmd is a wrapper for the 'compute last message digest' instruction.
src is padded and absorbed into the sponge state a.
If the function is a SHAKE XOF, the sponge is then optionally squeezed into
dst by first applying the permutation and then copying the output until dst
runs out. If len(dst) is a multiple of rate (including zero), the final
permutation is not applied. If the nopad bit of function is set and len(src)
is zero, only squeezing is performed.
go:noescape
func klmd(function code, a *[200]byte, dst []byte, src []byte)
leftEncode
function
#
func leftEncode(x uint64) []byte
newCShake
function
#
func newCShake(N []byte, S []byte, rate int, outputLen int, dsbyte byte) *SHAKE
padAndPermute
method
#
padAndPermute appends the domain separation bits in dsbyte, applies
the multi-bitrate 10..1 padding rule, and permutes the state.
func (d *Digest) padAndPermute()
permute
method
#
permute applies the KeccakF-1600 permutation.
func (d *Digest) permute()
read
method
#
func (d *Digest) read(out []byte) (n int, err error)
read
method
#
func (d *Digest) read(out []byte) (n int, err error)
read
method
#
func (d *Digest) read(out []byte) (n int, err error)
readGeneric
method
#
read squeezes an arbitrary number of bytes from the sponge.
func (d *Digest) readGeneric(out []byte) (n int, err error)
sum
method
#
func (d *Digest) sum(b []byte) []byte
sum
method
#
func (d *Digest) sum(b []byte) []byte
sum
method
#
func (d *Digest) sum(b []byte) []byte
sumGeneric
method
#
func (d *Digest) sumGeneric(b []byte) []byte
write
method
#
func (d *Digest) write(p []byte) (n int, err error)
write
method
#
func (d *Digest) write(p []byte) (n int, err error)
write
method
#
func (d *Digest) write(p []byte) (n int, err error)
writeGeneric
method
#
func (d *Digest) writeGeneric(p []byte) (n int, err error)