cmac

package module
v0.0.0-...-7af8419 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2016 License: MIT Imports: 5 Imported by: 0

README

Godoc Reference

The CMAC/OMAC1 message authentication code

The CMAC message authentication code is specified (with AES) in RFC 4493 and RFC 4494.
CMAC is only specified with the AES.

This implementation supports block ciphers with a block size of 64, 128, 256, 512 or 1024 bit.

Installation

Install in your GOPATH: go get -u github.com/aead/cmac

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
  • 128 bit
  • 256 bit
  • 512 bit
  • 1024 bit

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 (with AES) is specified in RFC 4493 and RFC 4494.

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.

func NewWithTagSize

func NewWithTagSize(c cipher.Block, tagsize int) (hash.Hash, error)

NewWithTagSize returns a hash.Hash computing the CMAC checksum with the given tag size. The tag size must between the 1 and the cipher's block size.

func Sum

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

Sum computes the CMAC checksum with the given tagsize of msg using the cipher.Block.

func Verify

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

Verify computes the CMAC checksum with the given tagsize of msg and compares it with the given mac. This functions returns true if and only if the given mac is equal to the computed one.

Types

This section is empty.

Directories

Path Synopsis
Package aes implements the CMAC MAC with the AES.
Package aes implements the CMAC MAC with the AES.

Jump to

Keyboard shortcuts

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