class Poco::MD5Engine

Overview

This class implementes the MD5 message digest algorithm, described in RFC 1321. Moreā€¦

#include <MD5Engine.h>

class MD5Engine: public Poco::DigestEngine
{
public:
    // enums

    enum
    {
        BLOCK_SIZE  = 64,
        DIGEST_SIZE = 16,
    };

    // structs

    struct Context;

    // methods

    virtual
    std::size_t
    digestLength() const;

    virtual
    void
    reset();

    virtual
    const DigestEngine::Digest&
    digest();

protected:
    // methods

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

Inherited Members

public:
    // typedefs

    typedef std::vector<unsigned char> Digest;

    // methods

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

    void
    update(char data);

    void
    update(const std::string& data);

    virtual
    std::size_t
    digestLength() const = 0;

    virtual
    void
    reset() = 0;

    virtual
    const Digest&
    digest() = 0;

    static
    std::string
    digestToHex(const Digest& bytes);

    static
    Digest
    digestFromHex(const std::string& digest);

protected:
    // methods

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

Detailed Documentation

This class implementes the MD5 message digest algorithm, described in RFC 1321.

Methods

virtual
std::size_t
digestLength() const

Returns the length of the digest in bytes.

virtual
void
reset()

Resets the engine so that a new digest can be computed.

virtual
const DigestEngine::Digest&
digest()

Finishes the computation of the digest and returns the message digest.

Resets the engine and can thus only be called once for every digest. The returned reference is valid until the next time digest() is called, or the engine object is destroyed.

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

Updates the digest with the given data.

Must be implemented by subclasses.