Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

cipherfil.cpp

00001 /******************************************************************************
00002  *
00003  * cipherfil -  SWFilter decendant to decipher a module
00004  */
00005 
00006 
00007 #include <stdlib.h>
00008 #include <string.h>
00009 #include <cipherfil.h>
00010 
00011 
00012 CipherFilter::CipherFilter(const char *key) {
00013         cipher = new SWCipher((unsigned char *)key);
00014 }
00015 
00016 
00017 CipherFilter::~CipherFilter() {
00018         delete cipher;
00019 }
00020 
00021 
00022 SWCipher *CipherFilter::getCipher() {
00023         return cipher;
00024 }
00025 
00026 
00027 char CipherFilter::ProcessText(char *text, int maxlen, const SWKey *key, const SWModule *module) {
00028         unsigned int len;
00029 //      len = strlen(text);
00030         len = maxlen;
00031      if (len > 0) {
00032                 cipher->cipherBuf(&len, text);
00033                 strncpy(text, cipher->Buf(), (len < (unsigned int)maxlen) ? len : maxlen);
00034      }
00035         text[maxlen] = 0;
00036         text[maxlen+1] = 0;
00037         return 0;
00038 }

Generated on Thu Jun 20 22:12:58 2002 for The Sword Project by doxygen1.2.15