-rw-r--r-- | noncore/apps/zsafe/krc2.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/noncore/apps/zsafe/krc2.h b/noncore/apps/zsafe/krc2.h new file mode 100644 index 0000000..87b5d29 --- a/dev/null +++ b/noncore/apps/zsafe/krc2.h @@ -0,0 +1,35 @@ +/* +** $Id$ +*/ + +#ifndef _KRC2_H_ +#define _KRC2_H_ + +/* Header file for rc2 implementation by Matthew Palmer <mjp16@uow.edu.au> */ + +class Krc2 +{ +public: + Krc2(); + ~Krc2(); + + /* Externally worked functions */ + void rc2_expandkey(char key[], int length, int ekl); + void rc2_encrypt(unsigned short *input); + void rc2_decrypt(unsigned short *input); + +private: + /* The internals */ + void _rc2_mix(unsigned short *input); + void _rc2_mash(unsigned short *input); + void _rc2_rmix(unsigned short *input); + void _rc2_rmash(unsigned short *input); + int _rc2_pow(int base, int exponent); + unsigned short _rc2_ror(unsigned short input, int places); + unsigned short _rc2_rol(unsigned short input, int places); + +}; +#endif // _KRC2_H_ + + + |