blob: a487514780e77974301d74b34a90ac0a3fcf70e3 (
plain) (
tree)
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>cipherfil.cpp Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.2.15 -->
<center>
<a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="namespaces.html">Namespace List</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="classes.html">Alphabetical List</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="functions.html">Compound Members</a> </center>
<hr><h1>cipherfil.cpp</h1><div class="fragment"><pre>00001 <font class="comment">/******************************************************************************</font>
00002 <font class="comment"> *</font>
00003 <font class="comment"> * cipherfil - SWFilter decendant to decipher a module</font>
00004 <font class="comment"> */</font>
00005
00006
00007 <font class="preprocessor">#include <stdlib.h></font>
00008 <font class="preprocessor">#include <string.h></font>
00009 <font class="preprocessor">#include <cipherfil.h></font>
00010
00011
00012 CipherFilter::CipherFilter(<font class="keyword">const</font> <font class="keywordtype">char</font> *key) {
00013 cipher = <font class="keyword">new</font> SWCipher((<font class="keywordtype">unsigned</font> <font class="keywordtype">char</font> *)key);
00014 }
00015
00016
00017 CipherFilter::~CipherFilter() {
00018 <font class="keyword">delete</font> cipher;
00019 }
00020
00021
00022 SWCipher *CipherFilter::getCipher() {
00023 <font class="keywordflow">return</font> cipher;
00024 }
00025
00026
00027 <font class="keywordtype">char</font> CipherFilter::ProcessText(<font class="keywordtype">char</font> *text, <font class="keywordtype">int</font> maxlen, <font class="keyword">const</font> <a class="code" href="class_s_w_key.html">SWKey</a> *key, <font class="keyword">const</font> <a class="code" href="class_s_w_module.html">SWModule</a> *module) {
00028 <font class="keywordtype">unsigned</font> <font class="keywordtype">int</font> len;
00029 <font class="comment">// len = strlen(text);</font>
00030 len = maxlen;
00031 <font class="keywordflow">if</font> (len > 0) {
00032 cipher->cipherBuf(&len, text);
00033 strncpy(text, cipher->Buf(), (len < (<font class="keywordtype">unsigned</font> <font class="keywordtype">int</font>)maxlen) ? len : maxlen);
00034 }
00035 text[maxlen] = 0;
00036 text[maxlen+1] = 0;
00037 <font class="keywordflow">return</font> 0;
00038 }
</pre></div><hr><address align="right"><small>Generated on Thu Jun 20 22:12:58 2002 for The Sword Project by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0
width=110 height=53></a>1.2.15 </small></address>
</body>
</html>
|