Hi,
On Sun, 2003-06-08 at 19:56, ccw wrote:
>
> The problem is, I cannot find the appropriate class in place of
> TheBaseCipherForAllCiphers.
> I try SymmetricCipherDocumentation, but always get a compiler error.
Did you take a look at the source (it comes included) ?
Why not provide some explanation of what you've tried or at least
include the compiler error message?
I haven't really checked, but it may not be possible to have a single
pointer type pointing to all the classes you wish to use - they may not
share a common parent with a useable interface or it may be that they
each inherit from different template instantiations (e.g.
FixedBlockSize<8> versus FixedBlockSize<16>).
In any case if you can't get it working, you can do it yourself...
Here's a pretty clean and flexible solution:
You create your own base class, say
class MyCryptor {
public:
virtual boost::shared_array<byte>
ProcessString(const std::string & toEncrypt) = 0;
};
and then derive from that abstract class for each of the ciphers you
want to use. Use a factory to create instances of appropriate subtypes
(returned as MyCryptor *) to get the work done:
cryptorInstance->ProcessString("Please keep this message secret");
A few notes:
- it will be simpler if you can find a common base class for all your
ciphers
- the ProcessString method I used is just off the top of my head. I
really hate dealing with memory issues, so I let others do it for me (if
you want more info on the boost library smart pointers, check out
http://boost.org/libs/smart_ptr/smart_ptr.htm)
HTH & Regards,
--
Pat Deegan,
http://www.psychogenic.com/
PGP: http://www.keyserver.net 0x03F86A50