sodium

package
v0.0.0-...-da01528 Latest Latest
Warning

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

Go to latest
Published: May 25, 2015 License: ISC Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OneTimeAuth

func OneTimeAuth(macOut []byte, message []byte, key []byte) int

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

func OneTimeAuthVerify(mac, message, key []byte) int

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

type OneTimeAuthState unsafe.Pointer

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.

Jump to

Keyboard shortcuts

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