libkeepass 0.2.0
KeePass key database importer/exporter library
Loading...
Searching...
No Matches
keepass::hashed_ostreambuf Class Referencefinal

Output streambuf that writes SHA-256-hashed, block-structured data. More...

#include <stream.hh>

Inheritance diagram for keepass::hashed_ostreambuf:
keepass::hashed_basic_streambuf

Public Member Functions

 hashed_ostreambuf (std::ostream &dst)
 Constructs an output streambuf with the default 1 MiB block size.
 
 hashed_ostreambuf (std::ostream &dst, uint32_t block_size)
 Constructs an output streambuf with a custom block size.
 
int overflow (int c) override
 Buffers a character; flushes the current block when it reaches capacity.
 
int sync () override
 Flushes any buffered data and writes the trailing empty end-of-stream block.
 

Detailed Description

Output streambuf that writes SHA-256-hashed, block-structured data.

Data is accumulated into blocks of a configurable size. Each block is flushed with a BlockHeader containing its SHA-256 hash. A trailing empty block is written on sync to signal end-of-stream.

Constructor & Destructor Documentation

◆ hashed_ostreambuf() [1/2]

keepass::hashed_ostreambuf::hashed_ostreambuf ( std::ostream &  dst)
inlineexplicit

Constructs an output streambuf with the default 1 MiB block size.

Parameters
dstThe output stream to write hashed blocks to.

◆ hashed_ostreambuf() [2/2]

keepass::hashed_ostreambuf::hashed_ostreambuf ( std::ostream &  dst,
uint32_t  block_size 
)
inline

Constructs an output streambuf with a custom block size.

Parameters
dstThe output stream to write hashed blocks to.
block_sizeThe maximum number of data bytes per block.

The documentation for this class was generated from the following file: