UI::Util::XConversion Class Reference

a class to convert between different systems. More...

`#include <Text.hpp>`

Collaboration diagram for UI::Util::XConversion:

## Static Public Member Functions

static std::string | dec2Basis (int number, int basis)
static int | basis2Dec (std::string number, int basis)
static UI::Util::auto_ptr< unsigned char > | xorEncrypt (std::string const &message, std::string const &key, int *length)
static std::string | xorDecrypt (const unsigned char *message, const int length, std::string const &key)
static std::string | base64Encode (const unsigned char *message, const int length)
static UI::Util::auto_ptr< unsigned char > | base64Decode (std::string const &message, int *length)

## Detailed Description

a class to convert between different systems.

Deprecated:
  All different conversions here should rather get a XXXConverter class in Recoder.?pp (and an appropriate switch in the Recoder class if needed).

## Member Function Documentation

## base64Decode()

UI::Util::auto_ptr< unsigned char > UI::Util::XConversion::base64Decode | ( | std::string const & | message,
|  | int * | length
| ) |  |

static

returns an array of bytes which were encoded in the passed character array.

Parameters

  message | a base64 encoded message
  length | used to store the result (Binary)

Returns
  number decoded chars

## base64Encode()

std::string UI::Util::XConversion::base64Encode | ( | const unsigned char * | message,
|  | const int | length
| ) |  |

static

returns an array of base64-encoded characters to represent the passed data array.

Parameters

  message | the array of bytes to encode
  length | length of the byte array

Returns
  result base64 encoded message (ASCII)

## basis2Dec()

int UI::Util::XConversion::basis2Dec | ( | std::string | number,
|  | int | basis
| ) |  |

static

Convert a number represented by any basis between
2 (bin) and 16 (hex) to a dezimal number (10)

Parameters

  number | the numbet to convert
  basis | the basis to use

Returns
  a number represented in decimal (basis 10)

## dec2Basis()

std::string UI::Util::XConversion::dec2Basis | ( | int | number,
|  | int | basis
| ) |  |

static

Convert a dezimal (10) represented number in a number
represented by any basis between 2 (Bin) and 16 (Hex)

Parameters

  number | the number to convert
  basis | the basis to use

Returns
  a number represented by the wanted basis
  or an empty string

## xorDecrypt()

std::string UI::Util::XConversion::xorDecrypt | ( | const unsigned char * | message,
|  | const int | length,
|  | std::string const & | key
| ) |  |

static

decrypt a message using xor and the given key

Parameters

  message | the message to decrypt
  length | the length of the message
  key | the key used to decrypt the message

Returns
  the decrypted message (ASCII)

## xorEncrypt()

UI::Util::auto_ptr< unsigned char > UI::Util::XConversion::xorEncrypt | ( | std::string const & | message,
|  | std::string const & | key,
|  | int * | length
| ) |  |

static

encrypt a message using xor and the given key

Parameters

  message | the mesaage to encrypt
  key | the key used to encrypt the message
  length | number of encrypted chars (return)

Returns
  the encrypted message (binary)

The documentation for this class was generated from the following files:

- Text.hpp
- Text.cpp