summaryrefslogtreecommitdiff
path: root/noncore/apps/zsafe/krc2.h
blob: 87b5d29663e93a9d387bdcdcce1476b843f8b316 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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_