Involved Source Filescast.gohashes.gokeccakf.go 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].
[FIPS 202]: https://doi.org/10.6028/NIST.FIPS.202
[SP 800-185]: https://doi.org/10.6028/NIST.SP.800-185sha3_amd64.goshake.gosha3_amd64.s
Package-Level Type Names (total 3, in which 2 are exported)
/* sort exporteds by: | */
// main state of the hash dsbyte contains the "domain separation" bits and the first bit of
the padding. Sections 6.1 and 6.2 of [1] separate the outputs of the
SHA-3 and SHAKE functions by appending bitstrings to the message.
Using a little-endian bit-ordering convention, these are "01" for SHA-3
and "1111" for SHAKE, or 00000010b and 00001111b, respectively. Then the
padding rule from section 5.1 is applied to pad the message to a multiple
of the rate, which involves adding a "1" bit, zero or more "0" bits, and
a final "1" bit. We merge the first "1" bit from the padding into dsbyte,
giving 00000110b (0x06) and 00011111b (0x1f).
[1] http://csrc.nist.gov/publications/drafts/fips-202/fips_202_draft.pdf
"Draft FIPS 202: SHA-3 Standard: Permutation-Based Hash and
Extendable-Output Functions (May 2014)" a[n:rate] is the buffer. If absorbing, it's the remaining space to XOR
into before running the permutation. If squeezing, it's the remaining
output to produce before running the permutation. // the default output size in bytes a[n:rate] is the buffer. If absorbing, it's the remaining space to XOR
into before running the permutation. If squeezing, it's the remaining
output to produce before running the permutation. // whether the sponge is absorbing or squeezing(*Digest) AppendBinary(b []byte) ([]byte, error) BlockSize returns the rate of sponge underlying this hash function.(*Digest) Clone() *Digest(*Digest) MarshalBinary() ([]byte, error) Reset resets the Digest to its initial state. Size returns the output size of the hash function in bytes. Sum appends the current hash to b and returns the resulting slice.
It does not change the underlying hash state.(*Digest) UnmarshalBinary(b []byte) error Write absorbs more data into the hash's state. padAndPermute appends the domain separation bits in dsbyte, applies
the multi-bitrate 10..1 padding rule, and permutes the state. permute applies the KeccakF-1600 permutation.(*Digest) read(out []byte) (n int, err error) read squeezes an arbitrary number of bytes from the sponge.(*Digest) sum(b []byte) []byte(*Digest) sumGeneric(b []byte) []byte(*Digest) write(p []byte) (n int, err error)(*Digest) writeGeneric(p []byte) (n int, err error)
*Digest : crypto/internal/fips140.Hash
*Digest : encoding.BinaryAppender
*Digest : encoding.BinaryMarshaler
*Digest : encoding.BinaryUnmarshaler
*Digest : hash.Hash
*Digest : internal/bisect.Writer
*Digest : io.Writer
*Digest : crypto/internal/fips140/hmac.marshalable
*Digest : crypto/tls.transcriptHash
func New224() *Digest
func New256() *Digest
func New384() *Digest
func New512() *Digest
func NewLegacyKeccak256() *Digest
func NewLegacyKeccak512() *Digest
func (*Digest).Clone() *Digest
func crypto/internal/fips140hash.sha3Unwrap(*sha3.SHA3) *Digest
func crypto/sha3.fips140hash_sha3Unwrap(sha3 *sha3.SHA3) *Digest
// SHA-3 state context and Read/Write operations 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 the method specified in 3.3 of [1].
It is stored here in order for Reset() to be able to put context into
initial state.(*SHAKE) AppendBinary(b []byte) ([]byte, error)(*SHAKE) BlockSize() int Clone returns a copy of the SHAKE context in its current state.(*SHAKE) MarshalBinary() ([]byte, error)(*SHAKE) Read(out []byte) (n int, err error) Reset resets the hash to initial state.(*SHAKE) Size() int 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.(*SHAKE) UnmarshalBinary(b []byte) error Write absorbs more data into the hash's state.
It panics if any output has already been read.
*SHAKE : crypto/internal/fips140.Hash
*SHAKE : encoding.BinaryAppender
*SHAKE : encoding.BinaryMarshaler
*SHAKE : encoding.BinaryUnmarshaler
*SHAKE : hash.Hash
*SHAKE : internal/bisect.Writer
*SHAKE : io.Reader
*SHAKE : io.ReadWriter
*SHAKE : io.Writer
*SHAKE : crypto/internal/fips140/hmac.marshalable
*SHAKE : crypto/tls.transcriptHash
func NewCShake128(N, S []byte) *SHAKE
func NewCShake256(N, S []byte) *SHAKE
func NewShake128() *SHAKE
func NewShake256() *SHAKE
func (*SHAKE).Clone() *SHAKE
func newCShake(N, S []byte, rate, outputLen int, dsbyte byte) *SHAKE
spongeDirection indicates the direction bytes are flowing through the sponge.
const spongeAbsorbing
const spongeSqueezing
Package-Level Functions (total 16, in which 10 are exported)
New224 returns a new Digest computing the SHA3-224 hash.
New256 returns a new Digest computing the SHA3-256 hash.
New384 returns a new Digest computing the SHA3-384 hash.
New512 returns a new Digest computing the SHA3-512 hash.
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.
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.
NewLegacyKeccak256 returns a new Digest computing the legacy, non-standard
Keccak-256 hash.
NewLegacyKeccak512 returns a new Digest computing the legacy, non-standard
Keccak-512 hash.