Whisper Library
 All Classes Functions Variables Typedefs Enumerations Friends
whisper_library::BitSetCoder< BLOCK_LENGTH > Class Template Reference

Converts the message into bit-blocks and reassembles them to a message (used by TcpHeaderCovertChannel) More...

Public Member Functions

size_t blockLength ()
 
vector< bitset< BLOCK_LENGTH > > encodeMessage (string message)
 encodeMessage takes a string and splits it into parts. More...
 
string decodeMessage (vector< bitset< BLOCK_LENGTH > > vector)
 

Detailed Description

template<size_t BLOCK_LENGTH>
class whisper_library::BitSetCoder< BLOCK_LENGTH >

Converts the message into bit-blocks and reassembles them to a message (used by TcpHeaderCovertChannel)

To use this class, call the function 'encodeMessage' with the message as a string or 'decodeMessage' with the message-blocks in a vector.

Template Parameters
BLOCK_LENGTHsets the length of the bit-blocks.

Member Function Documentation

template<size_t BLOCK_LENGTH>
size_t whisper_library::BitSetCoder< BLOCK_LENGTH >::blockLength ( )
inline

Returns the size of a message block.

Returns
the size of a message block as number of bits
template<size_t BLOCK_LENGTH>
string whisper_library::BitSetCoder< BLOCK_LENGTH >::decodeMessage ( vector< bitset< BLOCK_LENGTH > >  vector)
inline

decodeMessage takes bit blocks and converts them to characters returned as a string.

Parameters
vectora vector of bitsets with the bitsets containing the binary representation of ASCII-encoded letters.
Returns
the message as string
template<size_t BLOCK_LENGTH>
vector<bitset<BLOCK_LENGTH> > whisper_library::BitSetCoder< BLOCK_LENGTH >::encodeMessage ( string  message)
inline

encodeMessage takes a string and splits it into parts.

These are returned as a vector of bitsets in order. If you can't divide the bit count by BLOCK_LENGTH, the last bits are filled up with 0's. The bitsets contain the binary representation of ASCI-encoded letters.

Parameters
messagethe message to be encoded
Returns
the message as a vector of bitsets with the size of BLOCK_LENGTH