📄 classpcypher.html
字号:
<!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>PCypher class Reference</title><link href="doxygen.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.2.18 --><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="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="functions.html">Compound Members</a> <a class="qindex" href="globals.html">File Members</a> </center><hr><h1>PCypher Class Reference</h1><code>#include <<a class="el" href="cypher_8h-source.html">cypher.h</a>></code><p><p>Inheritance diagram for PCypher:<p><center><img src="classPCypher.png" usemap="#PCypher_map" border="0" alt=""></center><map name="PCypher_map"><area href="classPObject.html" alt="PObject" shape="rect" coords="0,0,86,24"><area href="classPTEACypher.html" alt="PTEACypher" shape="rect" coords="0,112,86,136"></map><a href="classPCypher-members.html">List of all members.</a><table border=0 cellpadding=0 cellspacing=0><tr><td></td></tr><tr><td colspan=2><br><h2>Public Types</h2></td></tr><tr><td nowrap align=right valign=top>enum </td><td valign=bottom><a class="el" href="classPCypher.html#s9">BlockChainMode</a> { <br> <a class="el" href="classPCypher.html#s9s0">ElectronicCodebook</a>, <a class="el" href="classPCypher.html#s9s1">ECB</a> = ElectronicCodebook, <a class="el" href="classPCypher.html#s9s2">CypherBlockChaining</a>, <a class="el" href="classPCypher.html#s9s3">CBC</a> = CypherBlockChaining, <br> <a class="el" href="classPCypher.html#s9s4">OutputFeedback</a>, <a class="el" href="classPCypher.html#s9s5">OFB</a> = OutputFeedback, <a class="el" href="classPCypher.html#s9s6">CypherFeedback</a>, <a class="el" href="classPCypher.html#s9s7">CFB</a> = CypherFeedback, <br> <a class="el" href="classPCypher.html#s9s8">NumBlockChainModes</a><br> }</td></tr><tr><td> </td><td><font size=-1><em>Mechanism by which sequential blocks are linked.</em> <a href="#s9">More...</a><em></em></font><br><br></td></tr><tr><td colspan=2><br><h2>Public Methods</h2></td></tr><tr><td nowrap align=right valign=top><a class="el" href="classPString.html">PString</a> </td><td valign=bottom><a class="el" href="classPCypher.html#a0">Encode</a> (const <a class="el" href="classPString.html">PString</a> &str)</td></tr><tr><td nowrap align=right valign=top><a class="el" href="classPString.html">PString</a> </td><td valign=bottom><a class="el" href="classPCypher.html#a1">Encode</a> (const <a class="el" href="classPBYTEArray.html">PBYTEArray</a> &clear)</td></tr><tr><td nowrap align=right valign=top><a class="el" href="classPString.html">PString</a> </td><td valign=bottom><a class="el" href="classPCypher.html#a2">Encode</a> (const void *data, PINDEX length)</td></tr><tr><td nowrap align=right valign=top>void </td><td valign=bottom><a class="el" href="classPCypher.html#a3">Encode</a> (const <a class="el" href="classPBYTEArray.html">PBYTEArray</a> &clear, <a class="el" href="classPBYTEArray.html">PBYTEArray</a> &coded)</td></tr><tr><td nowrap align=right valign=top>void </td><td valign=bottom><a class="el" href="classPCypher.html#a4">Encode</a> (const void *data, PINDEX length, <a class="el" href="classPBYTEArray.html">PBYTEArray</a> &coded)</td></tr><tr><td nowrap align=right valign=top><a class="el" href="classPString.html">PString</a> </td><td valign=bottom><a class="el" href="classPCypher.html#a5">Decode</a> (const <a class="el" href="classPString.html">PString</a> &cypher)</td></tr><tr><td nowrap align=right valign=top>BOOL </td><td valign=bottom><a class="el" href="classPCypher.html#a6">Decode</a> (const <a class="el" href="classPString.html">PString</a> &cypher, <a class="el" href="classPString.html">PString</a> &clear)</td></tr><tr><td nowrap align=right valign=top>BOOL </td><td valign=bottom><a class="el" href="classPCypher.html#a7">Decode</a> (const <a class="el" href="classPString.html">PString</a> &cypher, <a class="el" href="classPBYTEArray.html">PBYTEArray</a> &clear)</td></tr><tr><td nowrap align=right valign=top>PINDEX </td><td valign=bottom><a class="el" href="classPCypher.html#a8">Decode</a> (const <a class="el" href="classPString.html">PString</a> &cypher, void *data, PINDEX length)</td></tr><tr><td nowrap align=right valign=top>PINDEX </td><td valign=bottom><a class="el" href="classPCypher.html#a9">Decode</a> (const <a class="el" href="classPBYTEArray.html">PBYTEArray</a> &coded, void *data, PINDEX length)</td></tr><tr><td nowrap align=right valign=top>BOOL </td><td valign=bottom><a class="el" href="classPCypher.html#a10">Decode</a> (const <a class="el" href="classPBYTEArray.html">PBYTEArray</a> &coded, <a class="el" href="classPBYTEArray.html">PBYTEArray</a> &clear)</td></tr><tr><td colspan=2><br><h2>Protected Methods</h2></td></tr><tr><td nowrap align=right valign=top> </td><td valign=bottom><a class="el" href="classPCypher.html#b0">PCypher</a> (PINDEX <a class="el" href="classPCypher.html#n1">blockSize</a>, <a class="el" href="classPCypher.html#s9">BlockChainMode</a> <a class="el" href="classPCypher.html#n2">chainMode</a>)</td></tr><tr><td nowrap align=right valign=top> </td><td valign=bottom><a class="el" href="classPCypher.html#b1">PCypher</a> (const void *keyData, PINDEX keyLength, PINDEX <a class="el" href="classPCypher.html#n1">blockSize</a>, <a class="el" href="classPCypher.html#s9">BlockChainMode</a> <a class="el" href="classPCypher.html#n2">chainMode</a>)</td></tr><tr><td nowrap align=right valign=top>virtual void </td><td valign=bottom><a class="el" href="classPCypher.html#b2">Initialise</a> (BOOL encoding)=0</td></tr><tr><td nowrap align=right valign=top>virtual void </td><td valign=bottom><a class="el" href="classPCypher.html#b3">EncodeBlock</a> (const void *in, void *out)=0</td></tr><tr><td nowrap align=right valign=top>virtual void </td><td valign=bottom><a class="el" href="classPCypher.html#b4">DecodeBlock</a> (const void *in, void *out)=0</td></tr><tr><td colspan=2><br><h2>Protected Attributes</h2></td></tr><tr><td nowrap align=right valign=top><a class="el" href="classPBYTEArray.html">PBYTEArray</a> </td><td valign=bottom><a class="el" href="classPCypher.html#n0">key</a></td></tr><tr><td> </td><td><font size=-1><em>Key for the encryption/decryption.</em> <a href="#n0"></a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>PINDEX </td><td valign=bottom><a class="el" href="classPCypher.html#n1">blockSize</a></td></tr><tr><td> </td><td><font size=-1><em>Size of each encryption block in bytes.</em> <a href="#n1"></a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top><a class="el" href="classPCypher.html#s9">BlockChainMode</a> </td><td valign=bottom><a class="el" href="classPCypher.html#n2">chainMode</a></td></tr><tr><td> </td><td><font size=-1><em>Mode for sequential encryption each block.</em> <a href="#n2"></a><em></em></font><br><br></td></tr></table><hr><a name="_details"></a><h2>Detailed Description</h2>This abstract class defines an encryption/decryption algortihm. A specific algorithm is implemented in a descendent class. <p><hr><h2>Member Enumeration Documentation</h2><a name="s9" doxytag="PCypher::BlockChainMode"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> enum PCypher::BlockChainMode </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Mechanism by which sequential blocks are linked.<p><dl compact><dt><b>Enumeration values: </b></dt><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em><a name="s9s0" doxytag="ElectronicCodebook"></a><em>ElectronicCodebook</em></em> </td><td></td></tr><tr><td valign=top><em><a name="s9s1" doxytag="ECB"></a><em>ECB</em></em> </td><td></td></tr><tr><td valign=top><em><a name="s9s2" doxytag="CypherBlockChaining"></a><em>CypherBlockChaining</em></em> </td><td></td></tr><tr><td valign=top><em><a name="s9s3" doxytag="CBC"></a><em>CBC</em></em> </td><td></td></tr><tr><td valign=top><em><a name="s9s4" doxytag="OutputFeedback"></a><em>OutputFeedback</em></em> </td><td></td></tr><tr><td valign=top><em><a name="s9s5" doxytag="OFB"></a><em>OFB</em></em> </td><td></td></tr><tr><td valign=top><em><a name="s9s6" doxytag="CypherFeedback"></a><em>CypherFeedback</em></em> </td><td></td></tr><tr><td valign=top><em><a name="s9s7" doxytag="CFB"></a><em>CFB</em></em> </td><td></td></tr><tr><td valign=top><em><a name="s9s8" doxytag="NumBlockChainModes"></a><em>NumBlockChainModes</em></em> </td><td></td></tr></table></dl> </td> </tr></table><hr><h2>Constructor & Destructor Documentation</h2><a name="b0" doxytag="PCypher::PCypher"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> PCypher::PCypher </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">PINDEX </td> <td class="mdname" nowrap> <em>blockSize</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md" nowrap><a class="el" href="classPCypher.html#s9">BlockChainMode</a> </td> <td class="mdname" nowrap> <em>chainMode</em></td> </tr> <tr> <td></td> <td class="md">) </td> <td class="md" colspan="2"><code> [protected]</code></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Create a new encryption object instance. <dl compact><dt><b>Parameters: </b></dt><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>chainMode</em> </td><td>Size of encryption blocks (in bits) Block chain mode </td></tr></table></dl> </td> </tr></table><a name="b1" doxytag="PCypher::PCypher"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> PCypher::PCypher </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">const void * </td> <td class="mdname" nowrap> <em>keyData</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md" nowrap>PINDEX </td> <td class="mdname" nowrap> <em>keyLength</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md" nowrap>PINDEX </td> <td class="mdname" nowrap> <em>blockSize</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md" nowrap><a class="el" href="classPCypher.html#s9">BlockChainMode</a> </td> <td class="mdname" nowrap> <em>chainMode</em></td> </tr> <tr> <td></td> <td class="md">) </td> <td class="md" colspan="2"><code> [protected]</code></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p><dl compact><dt><b>Parameters: </b></dt><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>keyLength</em> </td><td>Key for the encryption/decryption algorithm. </td></tr><tr><td valign=top><em>blockSize</em> </td><td>Length of the key. </td></tr><tr><td valign=top><em>chainMode</em> </td><td>Size of encryption blocks (in bits) Block chain mode </td></tr></table></dl> </td> </tr></table><hr><h2>Member Function Documentation</h2><a name="a10" doxytag="PCypher::Decode"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> BOOL PCypher::Decode </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">const <a class="el" href="classPBYTEArray.html">PBYTEArray</a> & </td> <td class="mdname" nowrap> <em>coded</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md" nowrap><a class="el" href="classPBYTEArray.html">PBYTEArray</a> & </td> <td class="mdname" nowrap> <em>clear</em></td> </tr> <tr> <td></td> <td class="md">) </td> <td class="md" colspan="2"></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Decode the data. Decode the data using the algorithm embodied by the descendent class and the key specifed in the construction of the objects instance.<p>The first form takes a string and returns a decoded string. The second form takes an encoded string and returns arbitrary binary data bytes. In both cases the encoded string is always 7 bit printable ASCII suitable for use in mail systems etc.<p>The final form takes and arbitrary block of bytes and decodes them into another block of binary data.<p><dl compact><dt><b>Returns: </b></dt><dd> decoded string. </dl><dl compact><dt><b>Parameters: </b></dt><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>clear</em> </td><td>Encoded data (cyphertext). Clear text binary data decoded. </td></tr></table></dl> </td> </tr></table><a name="a9" doxytag="PCypher::Decode"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> PINDEX PCypher::Decode </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">const <a class="el" href="classPBYTEArray.html">PBYTEArray</a> & </td> <td class="mdname" nowrap> <em>coded</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md" nowrap>void * </td> <td class="mdname" nowrap> <em>data</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md" nowrap>PINDEX </td> <td class="mdname" nowrap> <em>length</em></td> </tr> <tr> <td></td> <td class="md">) </td> <td class="md" colspan="2"></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -