diff options
Diffstat (limited to 'doc/api-documentation/html/sapphire_8h-source.html')
-rw-r--r-- | doc/api-documentation/html/sapphire_8h-source.html | 118 |
1 files changed, 62 insertions, 56 deletions
diff --git a/doc/api-documentation/html/sapphire_8h-source.html b/doc/api-documentation/html/sapphire_8h-source.html index f36c275..8241699 100644 --- a/doc/api-documentation/html/sapphire_8h-source.html +++ b/doc/api-documentation/html/sapphire_8h-source.html @@ -3,65 +3,71 @@ <title>sapphire.h Source File</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> </head><body> -<!-- Generated by Doxygen 1.2.15 --> +<!-- Generated by Doxygen 1.2.17 --> <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>sapphire.h</h1><div class="fragment"><pre>00001 <font class="comment">/* sapphire.h -- Interface for the Saphire II stream cipher.</font> -00002 <font class="comment"></font> -00003 <font class="comment"> Dedicated to the Public Domain the author and inventor</font> -00004 <font class="comment"> (Michael Paul Johnson). This code comes with no warranty.</font> -00005 <font class="comment"> Use it at your own risk.</font> -00006 <font class="comment"> Ported from the Pascal implementation of the Sapphire Stream</font> -00007 <font class="comment"> Cipher 9 December 1994.</font> -00008 <font class="comment"> Added hash-specific functions 27 December 1994.</font> -00009 <font class="comment"> Made index variable initialization key-dependent,</font> -00010 <font class="comment"> made the output function more resistant to cryptanalysis,</font> -00011 <font class="comment"> and renamed to Sapphire II Stream Cipher 2 January 1995.</font> -00012 <font class="comment"></font> -00013 <font class="comment"> unsigned char is assumed to be 8 bits. If it is not, the</font> -00014 <font class="comment"> results of assignments need to be reduced to 8 bits with</font> -00015 <font class="comment"> & 0xFF or % 0x100, whichever is faster.</font> -00016 <font class="comment">*/</font> +<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="namespacemembers.html">Namespace Members</a> <a class="qindex" href="functions.html">Compound Members</a> </center> +<hr><h1>sapphire.h</h1><div class="fragment"><pre>00001 <span class="comment">/* sapphire.h -- Interface for the Saphire II stream cipher.</span> +00002 <span class="comment"></span> +00003 <span class="comment"> Dedicated to the Public Domain the author and inventor</span> +00004 <span class="comment"> (Michael Paul Johnson). This code comes with no warranty.</span> +00005 <span class="comment"> Use it at your own risk.</span> +00006 <span class="comment"> Ported from the Pascal implementation of the Sapphire Stream</span> +00007 <span class="comment"> Cipher 9 December 1994.</span> +00008 <span class="comment"> Added hash-specific functions 27 December 1994.</span> +00009 <span class="comment"> Made index variable initialization key-dependent,</span> +00010 <span class="comment"> made the output function more resistant to cryptanalysis,</span> +00011 <span class="comment"> and renamed to Sapphire II Stream Cipher 2 January 1995.</span> +00012 <span class="comment"></span> +00013 <span class="comment"> unsigned char is assumed to be 8 bits. If it is not, the</span> +00014 <span class="comment"> results of assignments need to be reduced to 8 bits with</span> +00015 <span class="comment"> & 0xFF or % 0x100, whichever is faster.</span> +00016 <span class="comment">*/</span> 00017 -00018 <font class="preprocessor">#ifndef NULL</font> -00019 <font class="preprocessor"></font><font class="preprocessor">#define NULL 0</font> -00020 <font class="preprocessor"></font><font class="preprocessor">#endif </font><font class="comment">/* */</font> -00021 <font class="keyword">class </font>sapphire -00022 { -00023 -00024 <font class="comment">// These variables comprise the state of the state machine.</font> -00025 <font class="keywordtype">unsigned</font> <font class="keywordtype">char</font> cards[256]; <font class="comment">// A permutation of 0-255.</font> -00026 <font class="keywordtype">unsigned</font> <font class="keywordtype">char</font> rotor, <font class="comment">// Index that rotates smoothly</font> -00027 ratchet, <font class="comment">// Index that moves erratically</font> -00028 avalanche, <font class="comment">// Index heavily data dependent</font> -00029 last_plain, <font class="comment">// Last plain text byte</font> -00030 last_cipher; <font class="comment">// Last cipher text byte</font> -00031 -00032 <font class="comment">// This function is used by initialize(), which is called by the</font> -00033 <font class="comment">// constructor.</font> -00034 <font class="keywordtype">unsigned</font> <font class="keywordtype">char</font> keyrand (<font class="keywordtype">int</font> limit, <font class="keywordtype">unsigned</font> <font class="keywordtype">char</font> *user_key, -00035 <font class="keywordtype">unsigned</font> <font class="keywordtype">char</font> keysize, <font class="keywordtype">unsigned</font> <font class="keywordtype">char</font> *rsum, -00036 <font class="keywordtype">unsigned</font> *keypos); <font class="keyword">public</font>:sapphire (<font class="keywordtype">unsigned</font> <font class="keywordtype">char</font> -00037 *key = NULL, <font class="comment">// Calls initialize if a real</font> -00038 <font class="keywordtype">unsigned</font> <font class="keywordtype">char</font> keysize = 0); <font class="comment">// key is provided. If none</font> -00039 <font class="comment">// is provided, call initialize</font> -00040 <font class="comment">// before encrypt or decrypt.</font> -00041 ~sapphire (); <font class="comment">// Destroy cipher state information.</font> -00042 <font class="keywordtype">void</font> initialize (<font class="keywordtype">unsigned</font> <font class="keywordtype">char</font> *key, <font class="comment">// User key is used to set</font> -00043 <font class="keywordtype">unsigned</font> <font class="keywordtype">char</font> keysize); <font class="comment">// up state information.</font> -00044 <font class="keywordtype">void</font> hash_init (<font class="keywordtype">void</font>); <font class="comment">// Set up default hash.</font> -00045 <font class="keywordtype">unsigned</font> <font class="keywordtype">char</font> encrypt (<font class="keywordtype">unsigned</font> <font class="keywordtype">char</font> b = 0); <font class="comment">// Encrypt byte</font> -00046 <font class="comment">// or get a random byte.</font> -00047 <font class="keywordtype">unsigned</font> <font class="keywordtype">char</font> decrypt (<font class="keywordtype">unsigned</font> <font class="keywordtype">char</font> b); <font class="comment">// Decrypt byte.</font> -00048 <font class="keywordtype">void</font> hash_final (<font class="keywordtype">unsigned</font> <font class="keywordtype">char</font> *hash, <font class="comment">// Copy hash value to hash</font> -00049 <font class="keywordtype">unsigned</font> <font class="keywordtype">char</font> hashlength = 20); <font class="comment">// Hash length (16-32)</font> -00050 <font class="keywordtype">void</font> burn (<font class="keywordtype">void</font>); <font class="comment">// Destroy cipher state information.</font> -00051 }; -00052 -00053 -</pre></div><hr><address align="right"><small>Generated on Thu Jun 20 22:13:00 2002 for The Sword Project by +00018 <span class="preprocessor">#ifndef NULL</span> +00019 <span class="preprocessor"></span><span class="preprocessor">#define NULL 0</span> +00020 <span class="preprocessor"></span><span class="preprocessor">#endif </span><span class="comment">/* */</span> +00021 +00022 <span class="preprocessor">#include <defs.h></span> +00023 +00024 SWORD_NAMESPACE_START +00025 +00026 <span class="keyword">class </span>sapphire +00027 { +00028 +00029 <span class="comment">// These variables comprise the state of the state machine.</span> +00030 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> cards[256]; <span class="comment">// A permutation of 0-255.</span> +00031 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> rotor, <span class="comment">// Index that rotates smoothly</span> +00032 ratchet, <span class="comment">// Index that moves erratically</span> +00033 avalanche, <span class="comment">// Index heavily data dependent</span> +00034 last_plain, <span class="comment">// Last plain text byte</span> +00035 last_cipher; <span class="comment">// Last cipher text byte</span> +00036 +00037 <span class="comment">// This function is used by initialize(), which is called by the</span> +00038 <span class="comment">// constructor.</span> +00039 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> keyrand (<span class="keywordtype">int</span> limit, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *user_key, +00040 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> keysize, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *rsum, +00041 <span class="keywordtype">unsigned</span> *keypos); <span class="keyword">public</span>:sapphire (<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> +00042 *key = NULL, <span class="comment">// Calls initialize if a real</span> +00043 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> keysize = 0); <span class="comment">// key is provided. If none</span> +00044 <span class="comment">// is provided, call initialize</span> +00045 <span class="comment">// before encrypt or decrypt.</span> +00046 ~sapphire (); <span class="comment">// Destroy cipher state information.</span> +00047 <span class="keywordtype">void</span> initialize (<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *key, <span class="comment">// User key is used to set</span> +00048 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> keysize); <span class="comment">// up state information.</span> +00049 <span class="keywordtype">void</span> hash_init (<span class="keywordtype">void</span>); <span class="comment">// Set up default hash.</span> +00050 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> encrypt (<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> b = 0); <span class="comment">// Encrypt byte</span> +00051 <span class="comment">// or get a random byte.</span> +00052 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> decrypt (<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> b); <span class="comment">// Decrypt byte.</span> +00053 <span class="keywordtype">void</span> hash_final (<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *hash, <span class="comment">// Copy hash value to hash</span> +00054 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> hashlength = 20); <span class="comment">// Hash length (16-32)</span> +00055 <span class="keywordtype">void</span> burn (<span class="keywordtype">void</span>); <span class="comment">// Destroy cipher state information.</span> +00056 }; +00057 +00058 +00059 SWORD_NAMESPACE_END +</pre></div><hr><address style="align: right;"><small>Generated on Thu Oct 31 12:11:28 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> +width=110 height=53></a>1.2.17 </small></address> </body> </html> |