FBB::DigestBuf(3bobcat)

Compute Message Digests
(libbobcat-dev_6.04.00)

2005-2023

NAME

FBB::DigestBuf - Computes Message Digests from information inserted into a std::ostream

SYNOPSIS

#include <bobcat/digestbuf>
Linking option: -lbobcat -lcrypto

DESCRIPTION

FBB::DigestBuf objects are std::streambuf objects that can be used to initialize std::ostream objects with.

The message digest of all information inserted into such an std::ostream is computed.

All the message digests defined by the OpenSSL library that can be selected by name may be used in combination with DigestBuf objects.

The currently supported message digest algorithms are shown by the openssl list -digest-commands. The names of the digest algorithms can be used to select a digest algorithms for the class's constructor, below.

NAMESPACE

FBB
All constructors, members, operators and manipulators, mentioned in this man-page, are defined in the namespace FBB.

INHERITS FROM

std::streambuf

CONSTRUCTORS

The copy and move constructors and assignment operators are not available.

OVERLOADED OPERATOR

MEMBER FUNCTIONS

All members of std::streambuf are available, as FBB::DigestBuf inherits from this class.

MANIPULATOR

EXAMPLE

#include <iostream>
#include <ostream>
#include <bobcat/digestbuf>

using namespace std;
using namespace FBB;

int main(int argc, char **argv)
try
{
    DigestBuf digestbuf(argc == 1 ? "sha256" : argv[1]);
    ostream out(&digestbuf);

    string hw("hello world\n");

    out << hw << eoi;
    cout << ">" << digestbuf << "<" << endl;

    digestbuf.reset();
    out.write(hw.c_str(), hw.length()) << eoi;
    cout << ">" << digestbuf << "<" << endl;
}
catch(exception const &err)
{
    cout << err.what() << endl;
    return 1;
}

FILES

bobcat/digestbuf - defines the class interface

SEE ALSO

bobcat(7), hmacbuf(3bobcat), std::streambuf

BUGS

None reported

BOBCAT PROJECT FILES

BOBCAT

Bobcat is an acronym of `Brokken's Own Base Classes And Templates'.

COPYRIGHT

This is free software, distributed under the terms of the GNU General Public License (GPL).

AUTHOR

Frank B. Brokken (f.b.brokken@rug.nl).