steghide 0.5.1
EmbData.h
Go to the documentation of this file.
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_EMBDATA_H
22#define SH_EMBDATA_H
23
24#include <string>
25#include <vector>
26
27#include "common.h"
28
29#include "BitString.h"
30#include "EncryptionAlgorithm.h"
31#include "EncryptionMode.h"
32
33class EmbData {
34 public:
35 enum MODE { EMBED, EXTRACT } ;
37
44 EmbData (MODE m, std::string pp, std::string fn = "") ;
45
46 BitString getBitString (void) ;
47
48 bool finished (void) ;
49
53 unsigned long getNumBitsRequested (void) ;
54
55 void addBits (BitString addbits) ;
56
58 EncryptionAlgorithm getEncAlgo (void) const ;
59
60 void setEncMode (EncryptionMode m) ;
61 EncryptionMode getEncMode (void) const ;
62
63 void setCompression (int c) ;
64 int getCompression (void) const ;
65
66 void setChecksum (bool c) ;
67 bool getChecksum (void) const ;
68
73 bool checksumOK (void) const ;
74
75 void setData (const std::vector<BYTE> data)
76 { Data = data ; } ;
77
78 std::vector<BYTE> getData (void) const
79 { return Data ; } ;
80
81 std::string getFileName (void) const
82 { return FileName ; } ;
83
85 static const unsigned int MinStegoHeaderSize = 50 ;
86
87 protected:
88 std::string stripDir (std::string s) ;
89
90 private:
92 static const unsigned int NBitsNPlainBits = 32 ;
94 static const unsigned int NBitsNUncompressedBits = 32 ;
96 static const unsigned int NBitsCrc32 = 32 ;
98 static const unsigned short CodeVersion = 0 ;
100 static const UWORD32 Magic = 0x73688DUL ;
102 static const unsigned int NBitsMagic = 24 ;
103
106
107 unsigned long NPlainBits ;
108
110 unsigned long NumBitsRequested ;
112 unsigned long NumBitsNeeded ;
113
115
116 std::string Passphrase ;
117
119 unsigned short Version ;
120
126 bool Checksum ;
128 unsigned long CRC32 ;
129 std::string FileName ;
131 std::vector<BYTE> Data ;
132} ;
133
134#endif // ndef SH_EMBDATA_H
a string of bits
Definition BitString.h:42
Definition EmbData.h:33
MODE
Definition EmbData.h:35
@ EXTRACT
Definition EmbData.h:35
@ EMBED
Definition EmbData.h:35
bool checksumOK(void) const
Definition EmbData.cc:248
unsigned long NumBitsRequested
the number of bits that the caller must at least supply to addBits
Definition EmbData.h:110
BitString Reservoir
Definition EmbData.h:114
int Compression
compression level: 0(none),1(best speed),...,9(best compression)
Definition EmbData.h:124
bool Checksum
will a checksum be embedded ?
Definition EmbData.h:126
unsigned long NPlainBits
Definition EmbData.h:107
std::string Passphrase
Definition EmbData.h:116
static const UWORD32 Magic
steghide magic to recognize embedded data (the string "shm")
Definition EmbData.h:100
static const unsigned int NBitsCrc32
size of a crc32 checksum in bits
Definition EmbData.h:96
bool getChecksum(void) const
Definition EmbData.cc:305
static const unsigned int MinStegoHeaderSize
the minimum size of the part of the generatred BitString that is not the data
Definition EmbData.h:85
void setData(const std::vector< BYTE > data)
Definition EmbData.h:75
std::vector< BYTE > getData(void) const
Definition EmbData.h:78
EncryptionAlgorithm EncAlgo
Definition EmbData.h:121
BitString getBitString(void)
Definition EmbData.cc:310
bool finished(void)
Definition EmbData.cc:42
void setEncMode(EncryptionMode m)
Definition EmbData.cc:280
void setChecksum(bool c)
Definition EmbData.cc:300
std::vector< BYTE > Data
contains the actual message to be embedded
Definition EmbData.h:131
unsigned long NumBitsNeeded
exactly the number of bits that the next step will consume from Reservoir and addBits together
Definition EmbData.h:112
static const unsigned short CodeVersion
version of this steghide embedding (stego compatibility of EmbData)
Definition EmbData.h:98
unsigned long CRC32
the checksum
Definition EmbData.h:128
EncryptionMode EncMode
Definition EmbData.h:122
EncryptionMode getEncMode(void) const
Definition EmbData.cc:285
static const unsigned int NBitsNUncompressedBits
number of bits used to code the number of uncompressed bits
Definition EmbData.h:94
void addBits(BitString addbits)
Definition EmbData.cc:54
STATE
Definition EmbData.h:36
@ READ_NPLAINBITS
Definition EmbData.h:36
@ READ_ENCINFO
Definition EmbData.h:36
@ READ_VERSION
Definition EmbData.h:36
@ READ_MAGIC
Definition EmbData.h:36
@ READ_ENCRYPTED
Definition EmbData.h:36
@ END
Definition EmbData.h:36
static const unsigned int NBitsNPlainBits
number of bits used to code the number of plain bits
Definition EmbData.h:92
unsigned short Version
version read from input bitstring
Definition EmbData.h:119
EncryptionAlgorithm getEncAlgo(void) const
Definition EmbData.cc:275
unsigned long getNumBitsRequested(void)
Definition EmbData.cc:48
void setCompression(int c)
Definition EmbData.cc:290
STATE State
Definition EmbData.h:105
static const unsigned int NBitsMagic
size (in bits of Magic)
Definition EmbData.h:102
std::string stripDir(std::string s)
Definition EmbData.cc:366
std::string getFileName(void) const
Definition EmbData.h:81
int getCompression(void) const
Definition EmbData.cc:295
MODE Mode
Definition EmbData.h:104
std::string FileName
Definition EmbData.h:129
void setEncAlgo(EncryptionAlgorithm a)
Definition EmbData.cc:270
Definition EncryptionAlgorithm.h:26
Definition EncryptionMode.h:26
unsigned long UWORD32
Definition common.h:45