SourceForge Logo
Main Page   Compound List   File List   Compound Members   File Members  

RC2.h

Go to the documentation of this file.
00001 /*!
00002  * \file RC2.h
00003  * \brief C++ implementation of RC2 encryption algorithm, as described in 
00004  *              RFC2268, adapted from the C library of Matthew Palmer <mjp16@uow.edu.au>
00005  *
00006  * \author Frederic RUAUDEL <grumz@users.sf.net>
00007  *
00008  * $Revision: 1.5 $
00009  * $Date: 2003/02/14 14:23:24 $
00010  *
00011  * \b GPasmanRC2Plugin
00012  * Copyleft (c) 2002 Frederic RUAUDEL, all rights reversed
00013  *
00014  * This program is free software which I release under the GNU General Public
00015  * License. You may redistribute and/or modify this program under the terms
00016  * of that license as published by the Free Software Foundation; either
00017  * version 2 of the License, or (at your option) any later version.
00018  *
00019  * This program is distributed in the hope that it will be useful,
00020  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00021  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00022  * GNU General Public License for more details.  Version 2 is in the
00023  * COPYING file in the top level directory of this distribution.
00024  *
00025  * To get a copy of the GNU General Public License, write to the Free Software
00026  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00027  **/
00028 
00029 #ifndef RC2_H
00030 #define RC2_H
00031 
00032 #include <stdio.h>
00033 
00034 using namespace std;
00035 
00036 /*!
00037  * \brief C++ implementation of RC2 encryption algorithm, as described in RFC2268, 
00038  *              adapted from the C library of Matthew Palmer <mjp16@uow.edu.au>
00039  **/
00040 class RC2 
00041 {
00042         static unsigned char pitable[];
00043         static unsigned char expkey[128];
00044         static int counter;
00045         static int s[];
00046 
00047         static void mix(unsigned short *);
00048         static void mash(unsigned short *);
00049         static void rmix(unsigned short *);
00050         static void rmash(unsigned short *);
00051         static int pow(int, int);
00052         static unsigned short ror(unsigned short, int);
00053         static unsigned short rol(unsigned short, int);
00054 
00055 public:
00056 
00057         static void expandkey(unsigned char [], int, int);
00058         static void encrypt(unsigned short *);
00059         static void decrypt(unsigned short *);
00060 };
00061         
00062 #endif /* RC2_H */

Generated on Sun Mar 9 11:13:54 2003 for GPasmanRC2Plugin by doxygen1.2.15