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.
11 #include "wvencoder.h"
12 #include "wvencoderstream.h"
15 * An encoder implementing simple XOR encryption.
16 * Mainly useful for testing.
18 class WvXOREncoder
: public WvEncoder
22 * Creates a new XOR encoder / decoder.
24 * _keylen : the length of the key in bytes
26 WvXOREncoder(const void *_key
, size_t _keylen
);
27 virtual ~WvXOREncoder();
30 bool _encode(WvBuf
&in
, WvBuf
&out
, bool flush
);
40 * A crypto stream implementing XOR encryption.
41 * See WvXOREncoder for details.
43 class WvXORStream
: public WvEncoderStream
46 WvXORStream(WvStream
*_cloned
, const void *key
, size_t _keysize
);
47 virtual ~WvXORStream() { }
49 const char *wstype() const { return "WvXORStream"; }