Class digest

Synopsis

#include "breeze/cryptography/digest.hpp"

template< typename Hasher >
class digest
    :   private equality_comparison< digest< Hasher > >

Description

The result of applying a digest algorithm to a given input sequence.

Inheritance

Ancestors: equality_comparison< digest< Hasher > >

Constructors, destructor and copy assignment

digest uses the compiler-generated copy constructor, destructor and copy assignment operator.

The other constructors are listed below.

digest overloadConstructs a digest from a Hasher
digest overloadConstructs the digest of the range [begin, end)

Functions for byte-based iteration (read-only)

Note
const_iterator is a forward iterator.

begin
end

Classes

lessA functor to compare digest objects.

Methods

is_equalEquality comparison (both == and != are provided).

Source

Lines 29-104 in breeze/cryptography/digest.hpp.

template< typename Hasher >
class digest
    :   private equality_comparison< digest< Hasher > >
{
public:
    typedef typename Hasher::byte_type const *
                        const_iterator ;

    //!     \name Constructors, destructor and copy assignment
    //!
    //!     \c digest uses the compiler-generated copy constructor,
    //!     destructor and copy assignment operator.
    //!
    //!     The other constructors are listed below.
    //!
    //!\{
    // -----------------------------------------------------------------------
    //!     Constructs a digest from a \c Hasher. Since the \c Hasher
    //!     argument is passed by value its state is not affected.
    // -----------------------------------------------------------------------
    explicit            digest( Hasher hasher_copy ) ;

    //!     Constructs the digest of the range <tt>[begin, end)</tt>.
    //!     This constructor saves the user from constructing a \c
    //!     Hasher object explicitly, but, of course, is only suitable
    //!     if the input range is all available at once. If you need to
    //!     accumulate the input in multiple steps, you'll need to use a
    //!     \c Hasher in your client code, instead.
    // -----------------------------------------------------------------------
    template< typename InputIter >
                        digest( InputIter begin, InputIter end ) ;
    //!\}


    //!     Equality comparison (both \c == and \c != are provided).
    // -----------------------------------------------------------------------
    bool                is_equal( digest< Hasher > const & ) const ;

    //!     \name Functions for byte-based iteration (read-only)
    //!
    //!     \note
    //!         \c const_iterator is a forward iterator.
    //          [gps]
    //!\{
    const_iterator      begin() const ;
    const_iterator      end() const ;
    //!\}

    class               less ;
    friend class        less ;
    //      less:
    //      =====
    //
    //!     \brief
    //!         A functor to compare digest objects.
    //!
    //!     Implements a strict weak ordering relation between digests
    //!     (from the same \c Hasher type). Useful for ordered
    //!     associative containers.
    //!
    //!     The function call operator is not \c noexcept, and the class
    //!     is a \c friend, because I'd like this part of the library,
    //!     which is the oldest, to be still compilable as C++03, if
    //!     needed.
    // -----------------------------------------------------------------------
    class               less
    {
    public:
        bool                operator()( digest< Hasher > const & d1,
                                        digest< Hasher > const & d2 ) const ;
    } ;

private:
    typename Hasher::raw_digest_type
                        m_raw_digest ;
} ;