blob: ad55396060d2c6c86d585dd4db2a533e7932ed6b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
/******************************************************************************
*
* cipherfil - SWFilter decendant to decipher a module
*/
#include <stdlib.h>
#include <string.h>
#include <cipherfil.h>
CipherFilter::CipherFilter(const char *key) {
cipher = new SWCipher((unsigned char *)key);
}
CipherFilter::~CipherFilter() {
delete cipher;
}
SWCipher *CipherFilter::getCipher() {
return cipher;
}
char CipherFilter::ProcessText(char *text, int maxlen, const SWKey *key, const SWModule *module) {
unsigned int len;
// len = strlen(text);
len = maxlen;
if (len > 0) {
cipher->cipherBuf(&len, text);
strncpy(text, cipher->Buf(), (len < (unsigned int)maxlen) ? len : maxlen);
}
text[maxlen] = 0;
text[maxlen+1] = 0;
return 0;
}
|