Documentation
¶
Overview ¶
Package kerl implements the Kerl hashing function.
Package kerl implements the Kerl hashing function.
Index ¶
- func KerlBytesToTrits(b []byte) (Trits, error)
- func KerlBytesToTrytes(b []byte) (Trytes, error)
- func KerlBytesZeroLastTrit(bytes []byte)
- func KerlTritsToBytes(trits Trits) ([]byte, error)
- func KerlTrytesToBytes(trytes Trytes) ([]byte, error)
- func NewKerl() SpongeFunction
- type Kerl
- func (k *Kerl) Absorb(in Trits) error
- func (k *Kerl) AbsorbTrytes(in Trytes) error
- func (k *Kerl) Clone() SpongeFunction
- func (k *Kerl) MustAbsorbTrytes(inn Trytes)
- func (k *Kerl) MustSqueeze(length int) Trits
- func (k *Kerl) MustSqueezeTrytes(length int) Trytes
- func (k *Kerl) Reset()
- func (k *Kerl) Squeeze(length int) (Trits, error)
- func (k *Kerl) SqueezeTrytes(length int) (Trytes, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func KerlBytesToTrits ¶
KerlBytesToTrits is only defined for hashes, i.e. chunks of 48 bytes. It returns 243 trits.
func KerlBytesToTrytes ¶
KerlBytesToTrytes is only defined for hashes, i.e. chunks of 48 bytes. It returns 81 trytes.
func KerlBytesZeroLastTrit ¶
func KerlBytesZeroLastTrit(bytes []byte)
KerlBytesZeroLastTrit changes a chunk of 48 bytes so that the corresponding ternary number has 242th trit set to 0.
func KerlTritsToBytes ¶
KerlTritsToBytes is only defined for hashes, i.e. chunks of trits of length 243. It returns 48 bytes.
func KerlTrytesToBytes ¶
KerlTrytesToBytes is only defined for hashes, i.e. chunks of trytes of length 81. It returns 48 bytes.
Types ¶
type Kerl ¶
type Kerl struct {
// contains filtered or unexported fields
}
Kerl is a to trinary aligned version of keccak
func (*Kerl) Absorb ¶
Absorb fills the internal state of the sponge with the given trits. This is only defined for Trit slices that are a multiple of HashTrinarySize long.
func (*Kerl) AbsorbTrytes ¶
AbsorbTrytes fills the internal State of the sponge with the given trytes.
func (*Kerl) Clone ¶
func (k *Kerl) Clone() SpongeFunction
Clone returns a deep copy of the current Kerl
func (*Kerl) MustAbsorbTrytes ¶
func (k *Kerl) MustAbsorbTrytes(inn Trytes)
AbsorbTrytes fills the internal State of the sponge with the given trytes. It panics if the given trytes are not valid.
func (*Kerl) MustSqueeze ¶
MustSqueeze squeezes out trits of the given length. Length has to be a multiple of HashTrinarySize. It panics if the length is not valid.
func (*Kerl) MustSqueezeTrytes ¶
MustSqueezeTrytes squeezes out trytes of the given trit length. Length has to be a multiple of HashTrinarySize. It panics if the trytes or the length are not valid.
func (*Kerl) SqueezeTrytes ¶
SqueezeTrytes squeezes out trytes of the given trit length. Length has to be a multiple of HashTrinarySize.
Directories
¶
Path | Synopsis |
---|---|
Package bigint implements a set of functions for big integer arithmetic.
|
Package bigint implements a set of functions for big integer arithmetic. |
Package sha3 implements the SHA-3 fixed-output-length hash functions and the SHAKE variable-output-length hash functions defined by FIPS-202.
|
Package sha3 implements the SHA-3 fixed-output-length hash functions and the SHAKE variable-output-length hash functions defined by FIPS-202. |