Documentation ¶
Index ¶
- func OneTimeAuth(macOut []byte, message []byte, key []byte) int
- func OneTimeAuthBytes() int
- func OneTimeAuthFinal(state OneTimeAuthState, macOut []byte) int
- func OneTimeAuthKeyBytes() int
- func OneTimeAuthUpdate(state OneTimeAuthState, inBuf []byte)
- func OneTimeAuthVerify(mac, message, key []byte) int
- type OneTimeAuthState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func OneTimeAuth ¶
OneTimeAuth computes a message authentication code (MAC) for the given input buffer and writes it to 'out'. 'out' must be a []byte of OneTimeAuthBytes() bytes. 'key' must not be used with any other messages.
Returns: 0 TODO: Can this ever return non-zero? If not should not return a value.
func OneTimeAuthBytes ¶
func OneTimeAuthBytes() int
OneTimeAuthBytes returns the size of the authenticator in bytes.
func OneTimeAuthFinal ¶
func OneTimeAuthFinal(state OneTimeAuthState, macOut []byte) int
OneTimeAuthFinal writes the final message authentication code to macOut based on the state computed by OneTimeAuthInit and OneTimeAuthUpdate. Once this function is called state is deallocated and may never be accessed again; this function must be called exactly once for each call to OneTimeAuthInit to avoid leaking memory.
func OneTimeAuthKeyBytes ¶
func OneTimeAuthKeyBytes() int
OneTimeAuthKeyBytes specifies the number of bytes in the symmetric key
func OneTimeAuthUpdate ¶
func OneTimeAuthUpdate(state OneTimeAuthState, inBuf []byte)
OneTimeAuthUpdate incrementally updates the MAC computation state with the contents of inBuf. Update may be called multiple times while consuming a message.
func OneTimeAuthVerify ¶
OneTimeAuthVerify verifies a message authentication code (MAC) for a given message and key.
Returns: 0 if the MAC authenticates the message, -1 if not.
Types ¶
type OneTimeAuthState ¶
Opaque structure representing the internal state of the MAC calculations.
func OneTimeAuthInit ¶
func OneTimeAuthInit(key []byte) OneTimeAuthState
OneTimeAuthInit initializes an internal state structure to allow incremental computation of a message authentication code. Warning: variance from libsodium: state is allocated here rather than passed in.