Boost logo

Boost :

From: Sergey (salaev_at_[hidden])
Date: 2007-03-23 07:59:42


Thanks for suggestion. My crypt_something class meant to be streamed
but i failed to describe it. crypt_something is buffered 'processor'
and user can call process() several time
example:
crypt_something cs;
cs.init(encryption_key);
...
while (!input_stream.eof())
{
  in_buffer = input_stream.read(); //reading to buffer from input stream
  size_t outsize = cs.process_outsize(in_buffer.begin(), in_buffer.end()); //determining
                  //amount of memory we will need to write output
  if (out_buffer.size() < outsize)
    out_buffer.resize(outsize);
  stream_buffer::iterator it = cs.process(in_buffer.begin(), in_buffer.end(), out_buffer.begin());
  out_stream.write(out_buffer.begin(), it);
}
//flushing buffer
size_t outsize = cs.flush_outsize<stream_buffer::item_type>();
if (out_buffer.size() < outsize)
  out_buffer.resize(outsize);
stream_buffer::iterator it = cs.flush(out_buffer.begin());
out_stream.write(out_buffer.begin(), it);

It is written in some kind of pseudo-code but i hope it is clear
enough now :)

Sergey.

On 3/23/07, Ames Andreas <Andreas.Ames_at_[hidden]> wrote:
>> -----Original Message-----
>> From: boost-bounces_at_[hidden]
>> [mailto:boost-bounces_at_[hidden]] On Behalf Of Sergey
>> Sent: Thursday, March 22, 2007 11:10 PM
>> To: boost_at_[hidden]
>> Subject: [boost] Cryptographic library for Boost
>>
>> template<class iIt, class oIt>
>> oIt process(iIt begin, iIt end, oIt out);
>>
>> Criticism is welcomed :)
>
>No criticism, just a thought/suggestion:
>
>As it stands, 'process' is linear.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk