# Poco

# template < class Engine >

# class HMACEngine

Library: Foundation
Package: Crypt
Header: Poco/HMACEngine.h

## Description

This class implements the HMAC message authentication code algorithm, as specified in RFC 2104. The underlying DigestEngine (MD5Engine, SHA1Engine, etc.) must be given as template argument. Since the HMACEngine is a DigestEngine, it can be used with the DigestStream class to create a HMAC for a stream.

## Inheritance

Direct Base Classes: DigestEngine

All Base Classes: DigestEngine

## Member Summary

Member Functions: digest, digestLength, init, reset, updateImpl

Inherited Functions: constantTimeEquals, digest, digestFromHex, digestLength, digestToHex, reset, update, updateImpl

## Enumerations

### Anonymous

BLOCK_SIZE = Engine::BLOCK_SIZE

DIGEST_SIZE = Engine::DIGEST_SIZE

## Constructors

### HMACEngine

HMACEngine(
const std::string & passphrase
);

### HMACEngine

HMACEngine(
const char * passphrase,
std::size_t length
);

## Destructor

### ~HMACEngine

~HMACEngine();

## Member Functions

### digest

const DigestEngine::Digest & digest();

### digestLength

std::size_t digestLength() const;

See also: Poco::DigestEngine::digestLength()

### reset

void reset();

See also: Poco::DigestEngine::reset()

### init

void init(
const char * passphrase,
std::size_t length
);

### updateImpl

void updateImpl(
const void * data,
std::size_t length
);

See also: Poco::DigestEngine::updateImpl()