cmac

package
v0.0.0-...-34d48bb Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2016 License: LGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package cmac implements the fast CMac MAC based on a block cipher. This mode of operation fixes security deficiencies of CBC-MAC (CBC-MAC is secure only for fixed-length messages). CMac is equal to OMAC1. This implementations supports block ciphers with a block size of:

  • 64 bit (8 byte)
  • 128 bit (16 byte)
  • 256 bit (32 byte)
  • 512 bit (64 byte)
  • 1024 bit (128 byte)

Common ciphers like AES, Serpent etc. operate on 128 bit blocks. 256, 512 and 1024 are supported for the Threefish tweakable block cipher. Ciphers with 64 bit blocks are supported, but not recommened. CMac (using AES) is specified in RFC 4493.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(c cipher.Block) (hash.Hash, error)

New returns a hash.Hash computing the CMac checksum. If the block cipher is not supported by CMac (see package doc), a non-nil error is returned.

func Sum

func Sum(msg []byte, c cipher.Block) ([]byte, error)

Sum computes the CMac checksum of msg using the cipher.Block. If the block cipher is not supported by CMac (see package doc), a non-nil error is returned.

func Verify

func Verify(mac, msg []byte, c cipher.Block) bool

Verify computes the CMac checksum of msg and compares it with the given mac. This functions returns true if and only if the given mac is equal to computed one. If the block cipher is not supported by CMac (see package doc), this function returns false.

Types

This section is empty.

Jump to

Keyboard shortcuts

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