# Poco

# template < class Engine >

# class HMACEngine

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

## Description

This class implementes 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: digest, 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,
unsigned length
);

## Destructor

### ~HMACEngine

~HMACEngine();

## Member Functions

### digest

const DigestEngine::Digest & digest();

### digestLength

unsigned digestLength() const;

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

### reset

void reset();

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

### init

void init(
const char * passphrase,
unsigned length
);

### updateImpl

void updateImpl(
const void * data,
unsigned length
);

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