1 /*
2  * steghide 0.5.1 - a steganography program
3  * Copyright (C) 1999-2003 Stefan Hetzl <shetzl@chello.at>
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18  *
19  */
20 
21 #ifndef SH_ENCALGO_H
22 #define SH_ENCALGO_H
23 
24 #include <string>
25 
26 class EncryptionAlgorithm {
27 	public:
28 	/// number of bits needed to code the algorithm
29 	static const unsigned int IRep_size = 5 ;
30 
31 	/// integer representation of encryption algorithm
32 	enum IRep {
33 		NONE = 0,
34 		TWOFISH = 1,
35 		RIJNDAEL128 = 2,
36 		RIJNDAEL192 = 3,
37 		RIJNDAEL256 = 4,
38 		SAFERPLUS = 5,
39 		RC2 = 6,
40 		XTEA = 7,
41 		SERPENT = 8,
42 		SAFERSK64 = 9,
43 		SAFERSK128 = 10,
44 		CAST256 = 11,
45 		LOKI97 = 12,
46 		GOST = 13,
47 		THREEWAY = 14,
48 		CAST128 = 15,
49 		BLOWFISH = 16,
50 		DES = 17,
51 		TRIPLEDES = 18,
52 		ENIGMA = 19,
53 		ARCFOUR = 20,
54 		PANAMA = 21,
55 		WAKE = 22
56 	} ;
57 
58 	EncryptionAlgorithm (void) ;
59 	EncryptionAlgorithm (IRep irep) ;
60 	/**
61 	 * construct a new EncryptionAlgorithm object from a std::string representation
62 	 * \param srep a valid(!) std::string representation
63 	 **/
64 	EncryptionAlgorithm (std::string srep) ;
65 
66 	void setValue (IRep irep) ;
67 
68 	std::string getStringRep (void) const ;
69 	IRep getIntegerRep (void) const ;
70 
71 	bool operator== (const EncryptionAlgorithm& algo) const
72 		{ return (Value == algo.Value) ; } ;
73 
74 	/**
75 	 * check if srep is a valid std::string representation (w.r.t the Translations array)
76 	 * \param srep a std::string that maybe represents an encryption algorithm fron the Translations table
77 	 * \return true iff the Translations table contains srep
78 	 **/
79 	static bool isValidStringRep (std::string srep) ;
80 
81 	static bool isValidIntegerRep (unsigned int irep) ;
82 
83 	/**
84 	 * translate an integer representation into the corresponding std::string representation
85 	 **/
86 	static std::string translate (IRep irep) ;
87 
88 	/**
89 	 * translate a valid std::string representation into the corresponding integer representation
90 	 **/
91 	static IRep translate (std::string srep) ;
92 
93 	private:
94 	static const unsigned int NumValues = 23 ;
95 	IRep Value ;
96 
97 	typedef struct struct_Translation {
98 		IRep	irep ;
99 		char*	srep ;
100 	} Translation ;
101 	static const Translation Translations[] ;
102 } ;
103 
104 #endif // ndef SH_ENCALGO_H
105