WvStreams
wvxor.h
1/* -*- Mode: C++ -*-
2 * Worldvisions Tunnel Vision Software:
3 * Copyright (C) 1997-2002 Net Integration Technologies, Inc.
4 *
5 * XOR cryptography abstractions.
6 * Could use this to implement short one time pads.
7 */
8#ifndef __WVXOR_H
9#define __WVXOR_H
10
11#include "wvencoder.h"
12#include "wvencoderstream.h"
13
18class WvXOREncoder : public WvEncoder
19{
20public:
26 WvXOREncoder(const void *_key, size_t _keylen);
27 virtual ~WvXOREncoder();
28
29protected:
30 bool _encode(WvBuf &in, WvBuf &out, bool flush);
31
32private:
33 unsigned char *key;
34 size_t keylen;
35 int keyoff;
36};
37
38
44{
45public:
46 WvXORStream(WvStream *_cloned, const void *key, size_t _keysize);
47 virtual ~WvXORStream() { }
48public:
49 const char *wstype() const { return "WvXORStream"; }
50};
51
52#endif
WvEncoderStream chains a series of encoders on the input and output ports of the underlying stream to...
The base encoder class.
Definition wvencoder.h:68
bool flush(WvBuf &inbuf, WvBuf &outbuf, bool finish=false)
Flushes the encoder and optionally finishes it.
Definition wvencoder.h:163
Unified support for streams, that is, sequences of bytes that may or may not be ready for read/write ...
Definition wvstream.h:25
An encoder implementing simple XOR encryption.
Definition wvxor.h:19
bool _encode(WvBuf &in, WvBuf &out, bool flush)
Template method implementation of encode().
Definition wvxor.cc:26
A crypto stream implementing XOR encryption.
Definition wvxor.h:44