Documentation
¶
Index ¶
- Constants
- type Strobe
- func (s *Strobe) AD(meta bool, additionalData []byte)
- func (s Strobe) Clone() *Strobe
- func (s *Strobe) KEY(key []byte)
- func (s *Strobe) Operate(meta bool, operation string, dataConst []byte, length int, more bool) []byte
- func (s *Strobe) PRF(outputLen int) []byte
- func (s *Strobe) RATCHET(length int)
- func (s *Strobe) Recv_AEAD(ciphertext, ad []byte) (plaintext []byte, ok bool)
- func (s *Strobe) Recv_CLR(meta bool, cleartext []byte)
- func (s *Strobe) Recv_ENC_unauthenticated(meta bool, ciphertext []byte) []byte
- func (s *Strobe) Recv_MAC(meta bool, MAC []byte) bool
- func (s *Strobe) Send_AEAD(plaintext, ad []byte) (ciphertext []byte)
- func (s *Strobe) Send_CLR(meta bool, cleartext []byte)
- func (s *Strobe) Send_ENC_unauthenticated(meta bool, plaintext []byte) []byte
- func (s *Strobe) Send_MAC(meta bool, output_length int) []byte
- func (s Strobe) Serialize() []byte
Constants ¶
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 ¶
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 ¶
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 ¶
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) 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 ¶
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) Recv_AEAD ¶
Recv_AEAD allows you to decrypt data and authenticate additional data It is similar to AES-GCM.
func (*Strobe) Recv_CLR ¶
Recv_CLR allows you to receive data in cleartext. `meta` is used to receive framing data
func (*Strobe) Recv_ENC_unauthenticated ¶
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 ¶
Recv_MAC allows you to verify a received authentication tag. `meta` is appropriate for checking the integrity of framing data.
func (*Strobe) Send_AEAD ¶
Send_AEAD allows you to encrypt data and authenticate additional data It is similar to AES-GCM.
func (*Strobe) Send_CLR ¶
Send_CLR allows you to send data in cleartext `meta` is used to send framing data
func (*Strobe) Send_ENC_unauthenticated ¶
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.