steghide
0.5.1
|
a string of bits More...
#include <BitString.h>
Public Member Functions | |
BitString (EmbValue arity=2) | |
BitString (const BitString &bs) | |
BitString (const unsigned long l) | |
BitString (const std::vector< BYTE > &d) | |
BitString (const std::string &d) | |
void | setArity (EmbValue arity) |
EmbValue | getArity (void) const |
UWORD32 | getLength (void) const |
UWORD32 | getNAryLength (void) const |
BitString & | clear (void) |
BitString & | append (const BIT v) |
BitString & | append (const BYTE v, const unsigned short n=8) |
BitString & | append (const UWORD16 v, const unsigned short n=16) |
BitString & | append (const UWORD32 v, const unsigned short n=32) |
BitString & | append (const std::string &v) |
BitString & | append (const std::vector< BYTE > &v) |
BitString & | append (const BitString &v) |
BitString & | setBit (unsigned long i, BIT v) |
BitString | getBits (const unsigned long s, const unsigned long l) const |
BitString | cutBits (const unsigned long s, const unsigned long l) |
UWORD32 | getValue (const unsigned long s, const unsigned short l) const |
const std::vector< BYTE > & | getBytes (void) const |
BitString & | truncate (const unsigned long s, const unsigned long e) |
BitString & | pad (const unsigned long mult, const BIT v) |
BitString & | padRandom (const unsigned long mult) |
BYTE | getNAry (unsigned long p) const |
void | appendNAry (BYTE v) |
BIT | operator[] (const unsigned long i) const |
BitString & | operator^= (const BitString &v) |
bool | operator== (const BitString &v) const |
bool | operator!= (const BitString &v) const |
void | print (unsigned short spc=0) const |
Private Member Functions | |
void | _append (BIT v) |
void | clearUnused (void) |
Private Attributes | |
UWORD32 | Length |
the number of bits in Data | |
EmbValue | Arity |
the arity that will be used for getLength/getNAry/appendNAry | |
unsigned short | ArityNBits |
the number of Bits per n-ary digit (where n is Arity) | |
std::vector< BYTE > | Data |
the actual data | |
This class provides a way to conveniently store and manipulate a string of bits. Various objects can be appended to a BitString.
For data storage a vector of BYTEs is used with little endian bit encoding, i.e. the first bit is the least significant bit of the first byte and so on.
BitString::BitString | ( | const BitString & | bs | ) |
copy constructor
BitString::BitString | ( | const unsigned long | l | ) |
construct a BitString containing l bits with value zero
BitString::BitString | ( | const std::vector< BYTE > & | d | ) |
construct a BitString containing the data in d
BitString::BitString | ( | const std::string & | d | ) |
construct a BitString containing the characters in d as 8 bit unsigned chars
|
private |
append n lower order bits of v to this BitString
v | the value to be appended |
n | the number of bits to be appended |
append n lower order bits of v to this BitString
v | the value to be appended |
n | the number of bits to be appended |
append n lower order bits of v to this BitString
v | the value to be appended |
n | the number of bits to be appended |
append the vector v byte-wise to this BitString
void BitString::appendNAry | ( | BYTE | v | ) |
append an n-ary digit to this BitString
v | the n-ary value to be appended |
BitString & BitString::clear | ( | void | ) |
delete the contents of this Bitstring
|
private |
clear unused part of last byte (_append depends on this)
BitString BitString::cutBits | ( | const unsigned long | s, |
const unsigned long | l | ||
) |
|
inline |
BitString BitString::getBits | ( | const unsigned long | s, |
const unsigned long | l | ||
) | const |
const std::vector< BYTE > & BitString::getBytes | ( | void | ) | const |
get the contents of this BitString as vector of bytes
getLength() % 8 must be 0 to call this function
BYTE BitString::getNAry | ( | unsigned long | p | ) | const |
|
inline |
UWORD32 BitString::getValue | ( | const unsigned long | s, |
const unsigned short | l | ||
) | const |
return a value composed from bits in this BitString
s | the index of the first bit to be used for the return value |
l | the total number of bits to be used for the return value (must be <= 32) |
bool BitString::operator!= | ( | const BitString & | v | ) | const |
bool BitString::operator== | ( | const BitString & | v | ) | const |
BIT BitString::operator[] | ( | const unsigned long | i | ) | const |
get the value of the i-th bit
BitString & BitString::padRandom | ( | const unsigned long | mult | ) |
void BitString::print | ( | unsigned short | spc = 0 | ) | const |
void BitString::setArity | ( | EmbValue | arity | ) |
set the p-th bit to v
i | the index (must be < getLength()) |
v | the value |
BitString & BitString::truncate | ( | const unsigned long | s, |
const unsigned long | e | ||
) |
|
private |
|
private |
|
private |
|
private |