kerl

package
v1.0.0-beta.11 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2019 License: MIT Imports: 8 Imported by: 14

Documentation

Overview

Package kerl implements the Kerl hashing function.

Package kerl implements the Kerl hashing function.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func KerlBytesToTrits

func KerlBytesToTrits(b []byte) (Trits, error)

KerlBytesToTrits is only defined for hashes, i.e. chunks of 48 bytes. It returns 243 trits.

func KerlBytesToTrytes

func KerlBytesToTrytes(b []byte) (Trytes, error)

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

func KerlTritsToBytes(trits Trits) ([]byte, error)

KerlTritsToBytes is only defined for hashes, i.e. chunks of trits of length 243. It returns 48 bytes.

func KerlTrytesToBytes

func KerlTrytesToBytes(trytes Trytes) ([]byte, error)

KerlTrytesToBytes is only defined for hashes, i.e. chunks of trytes of length 81. It returns 48 bytes.

func NewKerl

func NewKerl() SpongeFunction

NewKerl returns a new Kerl

Types

type Kerl

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

Kerl is a to trinary aligned version of keccak

func (*Kerl) Absorb

func (k *Kerl) Absorb(in Trits) error

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

func (k *Kerl) AbsorbTrytes(in Trytes) error

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

func (k *Kerl) MustSqueeze(length int) Trits

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

func (k *Kerl) MustSqueezeTrytes(length int) Trytes

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) Reset

func (k *Kerl) Reset()

Reset the internal state of the Kerl sponge.

func (*Kerl) Squeeze

func (k *Kerl) Squeeze(length int) (Trits, error)

Squeeze out length trits. Length has to be a multiple of HashTrinarySize.

func (*Kerl) SqueezeTrytes

func (k *Kerl) SqueezeTrytes(length int) (Trytes, error)

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.

Jump to

Keyboard shortcuts

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