strobe

package
v0.0.0-...-9a04d6c Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2022 License: Apache-2.0 Imports: 3 Imported by: 4

Documentation

Index

Constants

View Source
const (
	// The size of the authentication tag used in AEAD functions
	MACLEN = 16
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Strobe

type Strobe struct {
	StrobeR int // duplexRate - 2

	I0 role
	// contains filtered or unexported fields
}
We do not use strobe's `pos` variable here since it is easily
obtainable via `len(buf)`

TODO: accept permutations of different sizes

func InitStrobe

func InitStrobe(customizationString string, security int) (s Strobe)

InitStrobe allows you to initialize a new strobe instance with a customization string (that can be empty) and a security target (either 128 or 256).

func RecoverState

func RecoverState(serialized []byte) (s Strobe)

Recover state allows one to re-create a strobe state from a serialized state. [security(1)|initialized(1)|I0(1)|curFlags(1)|posBegin(1)|pos(1)|[25]uint64 state]

func (*Strobe) AD

func (s *Strobe) AD(meta bool, additionalData []byte)

AD allows you to authenticate Additional Data it should be followed by a Send_MAC or Recv_MAC in order to truly work

func (Strobe) Clone

func (s Strobe) Clone() *Strobe

Clone allows you to clone a Strobe state.

func (*Strobe) KEY

func (s *Strobe) KEY(key []byte)

KEY inserts a key into the state. It also provides forward secrecy.

func (*Strobe) Operate

func (s *Strobe) Operate(meta bool, operation string, dataConst []byte, length int, more bool) []byte

Operate runs an operation (see OperationMap for a list of operations). For operations that only require a length, provide the length via the length argument with an empty slice []byte{}. For other operations provide a zero length. Result is always retrieved through the return value. For boolean results, check that the first index is 0 for true, 1 for false.

func (*Strobe) PRF

func (s *Strobe) PRF(outputLen int) []byte

PRF provides a hash of length `output_len` of all previous operations It can also be used to generate random numbers, it is forward secure.

func (*Strobe) RATCHET

func (s *Strobe) RATCHET(length int)

RATCHET allows you to introduce forward secrecy in a protocol.

func (*Strobe) Recv_AEAD

func (s *Strobe) Recv_AEAD(ciphertext, ad []byte) (plaintext []byte, ok bool)

Recv_AEAD allows you to decrypt data and authenticate additional data It is similar to AES-GCM.

func (*Strobe) Recv_CLR

func (s *Strobe) Recv_CLR(meta bool, cleartext []byte)

Recv_CLR allows you to receive data in cleartext. `meta` is used to receive framing data

func (*Strobe) Recv_ENC_unauthenticated

func (s *Strobe) Recv_ENC_unauthenticated(meta bool, ciphertext []byte) []byte

Recv_ENC_unauthenticated is used to decrypt some received ciphertext it should be followed by Recv_MAC in order to protect its integrity `meta` is used for decrypting framing data.

func (*Strobe) Recv_MAC

func (s *Strobe) Recv_MAC(meta bool, MAC []byte) bool

Recv_MAC allows you to verify a received authentication tag. `meta` is appropriate for checking the integrity of framing data.

func (*Strobe) Send_AEAD

func (s *Strobe) Send_AEAD(plaintext, ad []byte) (ciphertext []byte)

Send_AEAD allows you to encrypt data and authenticate additional data It is similar to AES-GCM.

func (*Strobe) Send_CLR

func (s *Strobe) Send_CLR(meta bool, cleartext []byte)

Send_CLR allows you to send data in cleartext `meta` is used to send framing data

func (*Strobe) Send_ENC_unauthenticated

func (s *Strobe) Send_ENC_unauthenticated(meta bool, plaintext []byte) []byte

Send_ENC_unauthenticated is used to encrypt some plaintext it should be followed by Send_MAC in order to protect its integrity `meta` is used for encrypted framing data.

func (*Strobe) Send_MAC

func (s *Strobe) Send_MAC(meta bool, output_length int) []byte

Send_MAC allows you to produce an authentication tag. `meta` is appropriate for checking the integrity of framing data.

func (Strobe) Serialize

func (s Strobe) Serialize() []byte

Serialize allows one to serialize the strobe state to later recover it. [security(1)|initialized(1)|I0(1)|curFlags(1)|posBegin(1)|pos(1)|[25]uint64 state]

Jump to

Keyboard shortcuts

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