type Digest struct {
// contains filtered or unexported fields
}sha3
Package sha3 implements the SHA-3 fixed-output-length hash functions and the SHAKE variable-output-length functions defined by FIPS 202, as well as the cSHAKE extendable-output-length functions defined by SP 800-185.
type Digest source
Constructors
New224source
func New224() *DigestNew224 returns a new Digest computing the SHA3-224 hash.
New256source
func New256() *DigestNew256 returns a new Digest computing the SHA3-256 hash.
New384source
func New384() *DigestNew384 returns a new Digest computing the SHA3-384 hash.
New512source
func New512() *DigestNew512 returns a new Digest computing the SHA3-512 hash.
NewLegacyKeccak256source
func NewLegacyKeccak256() *DigestNewLegacyKeccak256 returns a new Digest computing the legacy, non-standard Keccak-256 hash.
NewLegacyKeccak512source
func NewLegacyKeccak512() *DigestNewLegacyKeccak512 returns a new Digest computing the legacy, non-standard Keccak-512 hash.
Methods
AppendBinarysource
func (d *Digest) AppendBinary(b []byte) ([]byte, error)BlockSizesource
func (d *Digest) BlockSize() intBlockSize returns the rate of sponge underlying this hash function.
Clonesource
func (d *Digest) Clone() *DigestMarshalBinarysource
func (d *Digest) MarshalBinary() ([]byte, error)Resetsource
func (d *Digest) Reset()Reset resets the Digest to its initial state.
Sizesource
func (d *Digest) Size() intSize returns the output size of the hash function in bytes.
Sumsource
func (d *Digest) Sum(b []byte) []byteSum appends the current hash to b and returns the resulting slice. It does not change the underlying hash state.
UnmarshalBinarysource
func (d *Digest) UnmarshalBinary(b []byte) errorWritesource
func (d *Digest) Write(p []byte) (n int, err error)Write absorbs more data into the hash's state.
type SHAKE source
type SHAKE struct {
// contains filtered or unexported fields
}Constructors
NewCShake128source
func NewCShake128(N, S []byte) *SHAKENewCShake128 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.
NewCShake256source
func NewCShake256(N, S []byte) *SHAKENewCShake256 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.
NewShake128source
func NewShake128() *SHAKENewShake128 creates a new SHAKE128 XOF.
NewShake256source
func NewShake256() *SHAKENewShake256 creates a new SHAKE256 XOF.
Methods
AppendBinarysource
func (s *SHAKE) AppendBinary(b []byte) ([]byte, error)BlockSizesource
func (s *SHAKE) BlockSize() intClonesource
func (s *SHAKE) Clone() *SHAKEClone returns a copy of the SHAKE context in its current state.
MarshalBinarysource
func (s *SHAKE) MarshalBinary() ([]byte, error)Readsource
func (s *SHAKE) Read(out []byte) (n int, err error)Resetsource
func (s *SHAKE) Reset()Reset resets the hash to initial state.
Sizesource
func (s *SHAKE) Size() intSumsource
func (s *SHAKE) Sum(in []byte) []byteSum 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.
UnmarshalBinarysource
func (s *SHAKE) UnmarshalBinary(b []byte) errorWritesource
func (s *SHAKE) Write(p []byte) (n int, err error)Write absorbs more data into the hash's state. It panics if any output has already been read.