summaryrefslogtreecommitdiff
path: root/api/2.0.1/node25.html
diff options
context:
space:
mode:
Diffstat (limited to 'api/2.0.1/node25.html')
-rw-r--r--api/2.0.1/node25.html104
1 files changed, 104 insertions, 0 deletions
diff --git a/api/2.0.1/node25.html b/api/2.0.1/node25.html
new file mode 100644
index 0000000..169561a
--- /dev/null
+++ b/api/2.0.1/node25.html
@@ -0,0 +1,104 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+
+<!--Converted with LaTeX2HTML 2008 (1.71)
+original version by: Nikos Drakos, CBLU, University of Leeds
+* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan
+* with significant contributions from:
+ Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
+<HTML>
+<HEAD>
+<TITLE>Adding Stream Encryption Algorithms</TITLE>
+<META NAME="description" CONTENT="Adding Stream Encryption Algorithms">
+<META NAME="keywords" CONTENT="pycrypt">
+<META NAME="resource-type" CONTENT="document">
+<META NAME="distribution" CONTENT="global">
+
+<META NAME="Generator" CONTENT="LaTeX2HTML v2008">
+<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
+
+<LINK REL="STYLESHEET" HREF="pycrypt.css">
+
+<LINK REL="previous" HREF="node24.html">
+<LINK REL="up" HREF="node22.html">
+<LINK REL="next" HREF="node26.html">
+</HEAD>
+
+<BODY >
+
+<DIV CLASS="navigation"><!--Navigation Panel-->
+<A NAME="tex2html359"
+ HREF="node26.html">
+<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A>
+<A NAME="tex2html355"
+ HREF="node22.html">
+<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A>
+<A NAME="tex2html351"
+ HREF="node24.html">
+<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A>
+<A NAME="tex2html357"
+ HREF="node1.html">
+<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A>
+<BR>
+<B> Next:</B> <A NAME="tex2html360"
+ HREF="node26.html">About this document ...</A>
+<B> Up:</B> <A NAME="tex2html356"
+ HREF="node22.html">Extending the Toolkit</A>
+<B> Previous:</B> <A NAME="tex2html352"
+ HREF="node24.html">Adding Block Encryption Algorithms</A>
+ &nbsp; <B> <A NAME="tex2html358"
+ HREF="node1.html">Contents</A></B>
+<BR>
+<BR></DIV>
+<!--End of Navigation Panel-->
+
+<H2><A NAME="SECTION00083000000000000000">
+Adding Stream Encryption Algorithms</A>
+</H2>
+
+<P>
+The required constant definitions are as follows:
+
+<P>
+<PRE>
+#define MODULE_NAME ARC4 /* Name of algorithm */
+#define BLOCK_SIZE 1 /* Will always be 1 for a stream cipher */
+#define KEY_SIZE 0 /* Size of key in bytes (0 if not fixed size) */
+</PRE>
+
+<P>
+The C structure must be named stream_state:
+
+<P>
+<PRE>
+typedef struct {
+ ... whatever state variables you need ...
+} stream_state;
+</PRE>
+
+<P>
+There are three functions that need to be written: to initialize the
+algorithm's state, and to encrypt and decrypt a single block.
+
+<P>
+
+<UL>
+<LI>void stream_init(stream_state *self, unsigned char *key,
+ int keylen);
+</LI>
+<LI>void stream_encrypt(stream_state *self, unsigned char *block,
+ int length);
+</LI>
+<LI>void stream_decrypt(stream_state *self, unsigned char *block,
+ int length);
+</LI>
+</UL>
+
+<P>
+Put #include "stream_template.c" at the end of the file to
+include the actual implementation of the module.
+
+<P>
+<BR><HR>
+
+</BODY>
+</HTML>