Thanks to visit codestin.com
Credit goes to pkg.go.dev

sha3

package standard library
go1.25.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 3, 2025 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Overview

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.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Digest

type Digest struct {
	// contains filtered or unexported fields
}

func New224

func New224() *Digest

New224 returns a new Digest computing the SHA3-224 hash.

func New256

func New256() *Digest

New256 returns a new Digest computing the SHA3-256 hash.

func New384

func New384() *Digest

New384 returns a new Digest computing the SHA3-384 hash.

func New512

func New512() *Digest

New512 returns a new Digest computing the SHA3-512 hash.

func NewLegacyKeccak256

func NewLegacyKeccak256() *Digest

NewLegacyKeccak256 returns a new Digest computing the legacy, non-standard Keccak-256 hash.

func NewLegacyKeccak512

func NewLegacyKeccak512() *Digest

NewLegacyKeccak512 returns a new Digest computing the legacy, non-standard Keccak-512 hash.

func (*Digest) AppendBinary

func (d *Digest) AppendBinary(b []byte) ([]byte, error)

func (*Digest) BlockSize

func (d *Digest) BlockSize() int

BlockSize returns the rate of sponge underlying this hash function.

func (*Digest) Clone

func (d *Digest) Clone() *Digest

func (*Digest) MarshalBinary

func (d *Digest) MarshalBinary() ([]byte, error)

func (*Digest) Reset

func (d *Digest) Reset()

Reset resets the Digest to its initial state.

func (*Digest) Size

func (d *Digest) Size() int

Size returns the output size of the hash function in bytes.

func (*Digest) Sum

func (d *Digest) Sum(b []byte) []byte

Sum appends the current hash to b and returns the resulting slice. It does not change the underlying hash state.

func (*Digest) UnmarshalBinary

func (d *Digest) UnmarshalBinary(b []byte) error

func (*Digest) Write

func (d *Digest) Write(p []byte) (n int, err error)

Write absorbs more data into the hash's state.

type SHAKE

type SHAKE struct {
	// contains filtered or unexported fields
}

func NewCShake128

func NewCShake128(N, S []byte) *SHAKE

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 NewCShake256

func NewCShake256(N, S []byte) *SHAKE

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 NewShake128

func NewShake128() *SHAKE

NewShake128 creates a new SHAKE128 XOF.

func NewShake256

func NewShake256() *SHAKE

NewShake256 creates a new SHAKE256 XOF.

func (*SHAKE) AppendBinary

func (s *SHAKE) AppendBinary(b []byte) ([]byte, error)

func (*SHAKE) BlockSize

func (s *SHAKE) BlockSize() int

func (*SHAKE) Clone

func (s *SHAKE) Clone() *SHAKE

Clone returns a copy of the SHAKE context in its current state.

func (*SHAKE) MarshalBinary

func (s *SHAKE) MarshalBinary() ([]byte, error)

func (*SHAKE) Read

func (s *SHAKE) Read(out []byte) (n int, err error)

func (*SHAKE) Reset

func (s *SHAKE) Reset()

Reset resets the hash to initial state.

func (*SHAKE) Size

func (s *SHAKE) Size() int

func (*SHAKE) Sum

func (s *SHAKE) Sum(in []byte) []byte

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 (*SHAKE) UnmarshalBinary

func (s *SHAKE) UnmarshalBinary(b []byte) error

func (*SHAKE) Write

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL