13 keylen(_keylen), keyoff(0)
15 key =
new unsigned char[keylen];
16 memcpy(key, _key, keylen);
20 WvXOREncoder::~WvXOREncoder()
31 const unsigned char *data = inbuf.
get(len);
32 unsigned char *out = outbuf.
alloc(len);
37 *out++ = (*data++) ^ key[keyoff++];
46 WvXORStream::WvXORStream(
WvStream *_cloned,
47 const void *_key,
size_t _keysize) :
50 readchain.append(
new WvXOREncoder(_key, _keysize),
true);
51 writechain.append(
new WvXOREncoder(_key, _keysize),
true);
const T * get(size_t count)
Reads exactly the specified number of elements and returns a pointer to a storage location owned by t...
WvEncoderStream chains a series of encoders on the input and output ports of the underlying stream to...
T * alloc(size_t count)
Allocates exactly the specified number of elements and returns a pointer to an UNINITIALIZED storage ...
WvXOREncoder(const void *_key, size_t _keylen)
Creates a new XOR encoder / decoder.
size_t optgettable() const
Returns the optimal maximum number of elements in the buffer currently available for reading without ...
Specialization of WvBufBase for unsigned char type buffers intended for use with raw memory buffers.
#define deletev
Remplacement for delete[].
Unified support for streams, that is, sequences of bytes that may or may not be ready for read/write ...
bool _encode(WvBuf &in, WvBuf &out, bool flush)
Template method implementation of encode().