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 
18 class WvXOREncoder : public WvEncoder
19 {
20 public:
26  WvXOREncoder(const void *_key, size_t _keylen);
27  virtual ~WvXOREncoder();
28 
29 protected:
30  bool _encode(WvBuf &in, WvBuf &out, bool flush);
31 
32 private:
33  unsigned char *key;
34  size_t keylen;
35  int keyoff;
36 };
37 
38 
44 {
45 public:
46  WvXORStream(WvStream *_cloned, const void *key, size_t _keysize);
47  virtual ~WvXORStream() { }
48 public:
49  const char *wstype() const { return "WvXORStream"; }
50 };
51 
52 #endif
WvEncoderStream
WvEncoderStream chains a series of encoders on the input and output ports of the underlying stream to...
Definition: wvencoderstream.h:37
WvEncoder
The base encoder class.
Definition: wvencoder.h:67
WvXORStream
A crypto stream implementing XOR encryption.
Definition: wvxor.h:43
WvXOREncoder::WvXOREncoder
WvXOREncoder(const void *_key, size_t _keylen)
Creates a new XOR encoder / decoder.
Definition: wvxor.cc:12
WvXOREncoder
An encoder implementing simple XOR encryption.
Definition: wvxor.h:18
WvBufBase< unsigned char >
Specialization of WvBufBase for unsigned char type buffers intended for use with raw memory buffers.
Definition: wvbuf.h:22
WvStream
Unified support for streams, that is, sequences of bytes that may or may not be ready for read/write ...
Definition: wvstream.h:24
WvXOREncoder::_encode
bool _encode(WvBuf &in, WvBuf &out, bool flush)
Template method implementation of encode().
Definition: wvxor.cc:26
WvEncoder::flush
bool flush(WvBuf &inbuf, WvBuf &outbuf, bool finish=false)
Flushes the encoder and optionally finishes it.
Definition: wvencoder.h:163