aboutsummaryrefslogtreecommitdiffstats
path: root/doc/api-documentation/html/sapphire_8h-source.html
diff options
context:
space:
mode:
authordanglassey <danglassey>2002-08-14 09:57:17 +0000
committerdanglassey <danglassey>2002-08-14 09:57:17 +0000
commitc9458897ebbb739d8db83c80e06512d8a612f743 (patch)
treef8c5381045887e34388cc6b26cfccc254bf766dc /doc/api-documentation/html/sapphire_8h-source.html
downloadsword-sf-cvs-c9458897ebbb739d8db83c80e06512d8a612f743.tar.gz
*** empty log message ***
Diffstat (limited to 'doc/api-documentation/html/sapphire_8h-source.html')
-rw-r--r--doc/api-documentation/html/sapphire_8h-source.html67
1 files changed, 67 insertions, 0 deletions
diff --git a/doc/api-documentation/html/sapphire_8h-source.html b/doc/api-documentation/html/sapphire_8h-source.html
new file mode 100644
index 0000000..f36c275
--- /dev/null
+++ b/doc/api-documentation/html/sapphire_8h-source.html
@@ -0,0 +1,67 @@
+<!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>sapphire.h 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> &nbsp; <a class="qindex" href="namespaces.html">Namespace List</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="classes.html">Alphabetical List</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; </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"> &amp; 0xFF or % 0x100, whichever is faster.</font>
+00016 <font class="comment">*/</font>
+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
+<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>