ui-utilcpp 1.10.3
Static Public Member Functions
UI::Util::XConversion Class Reference

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

#include <Text.hpp>

Collaboration diagram for UI::Util::XConversion:
Collaboration graph

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 charxorEncrypt (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 charbase64Decode (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
messagea base64 encoded message
lengthused 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
messagethe array of bytes to encode
lengthlength 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
numberthe numbet to convert
basisthe 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
numberthe number to convert
basisthe 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
messagethe message to decrypt
lengththe length of the message
keythe 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
messagethe mesaage to encrypt
keythe key used to encrypt the message
lengthnumber of encrypted chars (return)
Returns
the encrypted message (binary)

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