Fix several warnings that appear in gcc 4.3.2.
[wvstreams.git] / include / wvxor.h
blob53be5e1de33a08682603fdfb3188e4959ba5279e
1 /* -*- Mode: C++ -*-
2 * Worldvisions Tunnel Vision Software:
3 * Copyright (C) 1997-2002 Net Integration Technologies, Inc.
5 * XOR cryptography abstractions.
6 * Could use this to implement short one time pads.
7 */
8 #ifndef __WVXOR_H
9 #define __WVXOR_H
11 #include "wvencoder.h"
12 #include "wvencoderstream.h"
14 /**
15 * An encoder implementing simple XOR encryption.
16 * Mainly useful for testing.
18 class WvXOREncoder : public WvEncoder
20 public:
21 /**
22 * Creates a new XOR encoder / decoder.
23 * _key : the key
24 * _keylen : the length of the key in bytes
26 WvXOREncoder(const void *_key, size_t _keylen);
27 virtual ~WvXOREncoder();
29 protected:
30 bool _encode(WvBuf &in, WvBuf &out, bool flush);
32 private:
33 unsigned char *key;
34 size_t keylen;
35 int keyoff;
39 /**
40 * A crypto stream implementing XOR encryption.
41 * See WvXOREncoder for details.
43 class WvXORStream : public WvEncoderStream
45 public:
46 WvXORStream(WvStream *_cloned, const void *key, size_t _keysize);
47 virtual ~WvXORStream() { }
48 public:
49 const char *wstype() const { return "WvXORStream"; }
52 #endif /// __WVXOR_H