00001 /* 00002 * steghide 0.5.1 - a steganography program 00003 * Copyright (C) 1999-2003 Stefan Hetzl <shetzl@chello.at> 00004 * 00005 * This program is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU General Public License 00007 * as published by the Free Software Foundation; either version 2 00008 * of the License, or (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software 00017 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00018 * 00019 */ 00020 00021 #ifndef SH_EMBDATA_H 00022 #define SH_EMBDATA_H 00023 00024 #include <string> 00025 #include <vector> 00026 00027 #include "common.h" 00028 00029 #include "BitString.h" 00030 #include "EncryptionAlgorithm.h" 00031 #include "EncryptionMode.h" 00032 00033 class EmbData { 00034 public: 00035 enum MODE { EMBED, EXTRACT } ; 00036 enum STATE { READ_MAGIC, READ_VERSION, READ_ENCINFO, READ_NPLAINBITS, READ_ENCRYPTED, END } ; 00037 00044 EmbData (MODE m, std::string pp, std::string fn = "") ; 00045 00046 BitString getBitString (void) ; 00047 00048 bool finished (void) ; 00049 00053 unsigned long getNumBitsRequested (void) ; 00054 00055 void addBits (BitString addbits) ; 00056 00057 void setEncAlgo (EncryptionAlgorithm a) ; 00058 EncryptionAlgorithm getEncAlgo (void) const ; 00059 00060 void setEncMode (EncryptionMode m) ; 00061 EncryptionMode getEncMode (void) const ; 00062 00063 void setCompression (int c) ; 00064 int getCompression (void) const ; 00065 00066 void setChecksum (bool c) ; 00067 bool getChecksum (void) const ; 00068 00073 bool checksumOK (void) const ; 00074 00075 void setData (const std::vector<BYTE> data) 00076 { Data = data ; } ; 00077 00078 std::vector<BYTE> getData (void) const 00079 { return Data ; } ; 00080 00081 std::string getFileName (void) const 00082 { return FileName ; } ; 00083 00085 static const unsigned int MinStegoHeaderSize = 50 ; 00086 00087 protected: 00088 std::string stripDir (std::string s) ; 00089 00090 private: 00092 static const unsigned int NBitsNPlainBits = 32 ; 00094 static const unsigned int NBitsNUncompressedBits = 32 ; 00096 static const unsigned int NBitsCrc32 = 32 ; 00098 static const unsigned short CodeVersion = 0 ; 00100 static const UWORD32 Magic = 0x73688DUL ; 00102 static const unsigned int NBitsMagic = 24 ; 00103 00104 MODE Mode ; 00105 STATE State ; 00106 00107 unsigned long NPlainBits ; 00108 00110 unsigned long NumBitsRequested ; 00112 unsigned long NumBitsNeeded ; 00113 00114 BitString Reservoir ; 00115 00116 std::string Passphrase ; 00117 00119 unsigned short Version ; 00120 00121 EncryptionAlgorithm EncAlgo ; 00122 EncryptionMode EncMode ; 00124 int Compression ; 00126 bool Checksum ; 00128 unsigned long CRC32 ; 00129 std::string FileName ; 00131 std::vector<BYTE> Data ; 00132 } ; 00133 00134 #endif // ndef SH_EMBDATA_H