Documentation ¶
Overview ¶
Package kerl implements the Kerl hashing function.
Package kerl implements the Kerl hashing function.
Package kerl implements the Kerl hash function.
Index ¶
- Variables
- 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)
- type Kerl
- func (k *Kerl) Absorb(in trinary.Trits) error
- func (k *Kerl) AbsorbTrytes(in trinary.Trytes) error
- func (k *Kerl) Clone() SpongeFunction
- func (k *Kerl) MustAbsorbTrytes(in trinary.Trytes)
- func (k *Kerl) MustSqueeze(length int) trinary.Trits
- func (k *Kerl) MustSqueezeTrytes(length int) trinary.Trytes
- func (k *Kerl) Read(b []byte) (n int, err error)
- func (k *Kerl) Reset()
- func (k *Kerl) Size() int
- func (k *Kerl) Squeeze(length int) (trinary.Trits, error)
- func (k *Kerl) SqueezeTrytes(length int) (trinary.Trytes, error)
- func (k *Kerl) Sum(b []byte) []byte
- func (k *Kerl) Write(in []byte) (int, error)
Constants ¶
This section is empty.
Variables ¶
var ErrAbsorbAfterSqueeze = errors.New("absorb after squeeze")
ErrAbsorbAfterSqueeze is returned when absorb is called on the same hash after a squeeze.
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 { hash.Hash // underlying binary hashing function // 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 ¶
MustAbsorbTrytes 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) Read ¶
Read squeezes an arbitrary number of bytes. The buffer will be filled in multiples of HashByteSize.
func (*Kerl) SqueezeTrytes ¶
SqueezeTrytes squeezes out trytes of the given trit length. Length has to be a multiple of HashTrinarySize.
func (*Kerl) Sum ¶
Sum appends the current hash to b and returns the resulting slice. It does not change the underlying hash state.
func (*Kerl) Write ¶
Write absorbs more data into the hash's state. In oder to have consistent behavior with Absorb and AbsorbTrytes, it must be assured that the bytes written are multiples of HashByteSize and do not represent ternary numbers with a non-zero 243rd trit, e.g. by calling KerlBytesZeroLastTrit or by only using output from the Kerl hash function.
Directories ¶
Path | Synopsis |
---|---|
Package bigint contains a very lightweight and high-performance implementation of unsigned multi-precision integers.
|
Package bigint contains a very lightweight and high-performance implementation of unsigned multi-precision integers. |
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. |